0

I have searched the question/answers and it seems as if I should use a directive. I would however prefer to use the well tested ngInclude. The scenario is:

I am using ngInclude to fetch an external navigation bar(from a different site) and the returned html contains a login form, that points to a wrong url. My ngInclude looks like this: <div ng-include = "''+API_HOST+'api/cms/navbar'">

The login form part of the navbar looks something like this

<form id="loginForm" class="form-inline ng-pristine ng-valid" 
  method="post" 
  action="/somewebapp/j_spring_security_check" 
  name="loginForm" target="_top" 

I would like to modify the action attribute, to point to a different url.

Is there no other way than creating a directive to do that ? Thanks

isherwood
  • 58,414
  • 16
  • 114
  • 157
  • Possible duplicate of [Replace ng-include node with template?](http://stackoverflow.com/questions/16496647/replace-ng-include-node-with-template) – isherwood Oct 26 '15 at 16:00
  • You can use `ng-include` and also use a directive. See the possible duplicate above. – isherwood Oct 26 '15 at 16:00
  • I feel the simplest way to modify a template is to use jQuery in directive pre-compile function. – MarkoCen Oct 26 '15 at 17:32

1 Answers1

0

why you not use :

$scope.loaded = function(this_) { angular.element(document.getElementById("loginform")).children().attr("action", "yahoo.com"); }

see this plunker http://plnkr.co/edit/O4NyTULkBB6BpN4T9MNS?p=catalogue

Sandeep
  • 1,461
  • 13
  • 26