Forums de discussion

Liferay 7 reloads the Angular JS 2 component on click of anchor tag

JB Shaik, modifié il y a 7 années.

Liferay 7 reloads the Angular JS 2 component on click of anchor tag

Junior Member Publications: 35 Date d'inscription: 22/03/17 Publications récentes
Hi,

I'm trying to build a portlet in Liferay using Angular JS 2.

I have two tabs built in Angular JS 2 to display two tables of data. Whenever I hit on second tab, Liferay is reloading the whole page again. But my code was working fine on Node Js.

<ul class="nav nav-tabs">
      <li class="active">
        <a ng-reflect-href="#" href="#">TAB 1</a>
      </li><li>
        <a ng-reflect-href="#" href="#">TAB 2</a>
      </li>
    </ul>


Above is how the tabs are rendered on the browser. The moment I click on tab 2, it shows Tab2 and immediately the page is reloaded and tab is being selected.

Please assist
thumbnail
David H Nebinger, modifié il y a 7 années.

RE: Liferay 7 reloads the Angular JS 2 component on click of anchor tag

Liferay Legend Publications: 14916 Date d'inscription: 02/09/06 Publications récentes
When you are running in Liferay you have to understand there's a whole lot of JS and CSS that comes along with it.

You see a naked <a /> tag and think that you're in control of it. Liferay, however, has already assigned javascript to many things on the page.
JB Shaik, modifié il y a 7 années.

RE: Liferay 7 reloads the Angular JS 2 component on click of anchor tag

Junior Member Publications: 35 Date d'inscription: 22/03/17 Publications récentes
Thanks David. This was issue with Angular Js itself and not with Liferay. I managed to get a work around for this issue.

Thanks for your assistance on this.