Foren

How to call my portlets action method from Angular Js 2

JB Shaik, geändert vor 7 Jahren.

How to call my portlets action method from Angular Js 2

Junior Member Beiträge: 35 Beitrittsdatum: 22.03.17 Neueste Beiträge
Hi,

I'm using Angular Js2 and Liferay 7.

I want to call to my action method in portlet on clicking of my submit button( Angular Js 2 ). I managed to do the same with JSP and it was pretty simple and it's working. I want to do the same from Angular Js 2.

Working JSP :

<portlet:actionurl name="submitAction" var="submitActionURL"></portlet:actionurl>
<form action="${submitActionURL}" method="post">

<div>
<input type="submit" value="Submit Action" class="submit">
</div>
</form>


===============================================================================
I'm having issues with below code.

I added this in my view.jsp

<portlet:actionurl name="submitAction" var="submitActionURL"></portlet:actionurl>


And my html included in ts file has below code.

<form action="${submitActionURL}">
<div>
<input type="submit" value="Submit Action" class="submit">
</div>
</form>


Can you please assist.
thumbnail
David H Nebinger, geändert vor 7 Jahren.

RE: How to call my portlets action method from Angular Js 2

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
You shouldn't.

The action phase is part of a full lifecycle event of action -> render and that will throw out your whole angular context.

Instead you should be building out resource request handlers which can be invoked from the browser w/o involving a full portlet lifecycle event.
JB Shaik, geändert vor 7 Jahren.

RE: How to call my portlets action method from Angular Js 2

Junior Member Beiträge: 35 Beitrittsdatum: 22.03.17 Neueste Beiträge
Thanks David for the info.

Do you perhaps have an example for 'resource request handlers' in Liferay.
thumbnail
Ravi Darji, geändert vor 6 Jahren.

RE: How to call my portlets action method from Angular Js 2

Junior Member Beiträge: 56 Beitrittsdatum: 14.05.14 Neueste Beiträge
Hi Shaik,

Its humble request to you that,
Can you please share the portlet source code for reference? as i am also doing R&D for integration Angular js 2 in liferay 7.
My mail id is ravs.liferay@gmail.com

your help would be appreciated.

Thanks & Regards,
Ravi Darji
JB Shaik, geändert vor 6 Jahren.

RE: How to call my portlets action method from Angular Js 2

Junior Member Beiträge: 35 Beitrittsdatum: 22.03.17 Neueste Beiträge
Hi Ravi,

Sorry man. I haven't built that part yet. I was just busy with other stuff.

I will try and let you know If I come right with it. In meantime, please let me know If you are winning with this.
thumbnail
Ravi Darji, geändert vor 6 Jahren.

RE: How to call my portlets action method from Angular Js 2

Junior Member Beiträge: 56 Beitrittsdatum: 14.05.14 Neueste Beiträge
Sure JB Shaik