0

I have web app, and in this web app I have a lot generated input components. Generated components depends on user input parameter and dynamically added to web page.

One of this parameters is location picker. This is not necessary parameter so it also generated depends on user input. For location picker I use http://jsfiddle.net/mrajcok/pEq6X/ angular directive.

And my problem is when user add input, I add generated code that contains definition of ng-app, but this component does not works, because I need somehow to tell angular to parse html again. Is there are approach for that?

<div ng-app="Otd" ng-controller="SearchForm">
    <google-places location=location></google-places>
</div>

1 Answer 1

1

You might want to use $compile service from AngularJs.

That's what is used to compile and bind dynamic HTML content to angularJS components.

And also this guide: http://docs.angularjs.org/guide/compiler

E.g. Plunker Here

  element.html(value); //Setting the HTML Content

 // compile the new DOM and link it to the current
 // scope.
 // NOTE: we only compile .childNodes so that
 // we don't get into infinite loop compiling ourselves
 $compile(element.contents())(scope);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.