留言板

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

JB Shaik,修改在7 年前。

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

Junior Member 帖子: 35 加入日期: 17-3-22 最近的帖子
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,修改在7 年前。

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

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
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,修改在7 年前。

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

Junior Member 帖子: 35 加入日期: 17-3-22 最近的帖子
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.