Forums de discussion

How to call my portlets action method from Angular Js 2

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

How to call my portlets action method from Angular Js 2

Junior Member Publications: 35 Date d'inscription: 22/03/17 Publications récentes
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, modifié il y a 7 années.

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

Liferay Legend Publications: 14914 Date d'inscription: 02/09/06 Publications récentes
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, modifié il y a 6 années.

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

Junior Member Publications: 35 Date d'inscription: 22/03/17 Publications récentes
Thanks David for the info.

Do you perhaps have an example for 'resource request handlers' in Liferay.
thumbnail
Ravi Darji, modifié il y a 6 années.

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

Junior Member Publications: 56 Date d'inscription: 14/05/14 Publications récentes
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, modifié il y a 6 années.

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

Junior Member Publications: 35 Date d'inscription: 22/03/17 Publications récentes
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, modifié il y a 6 années.

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

Junior Member Publications: 56 Date d'inscription: 14/05/14 Publications récentes
Sure JB Shaik