1

A load content from jquery ajax, that contain ng-app="" and other directive. But it does't initialize. Now, How initialize a angularJS initialize ng-app that was added after page loaded.

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script>
<div ng-app="" class="uk-width-3-5 uk-grid">
                    <input class="uk-width-4-5" ng-model="classe" placeholder="Nivel academico..." type="range" min="1" max="13" value="14" name="classe" required>
                    <b class="uk-width-1-5">{{classe}}ª Classe</b>
                </div>

1

2 Answers 2

2

I think you should use angular.bootstrap. Call it when your DOM is ready and everything has been appended.

angular.bootstrap(document, ['myApp']);

This will start angular on the document, as if it had ng-app on it. You can bootstrap it to whatever element you want though.

Hope this helps

Sign up to request clarification or add additional context in comments.

Comments

1
<!doctype html>
<html>
<body>
  <div ng-controller="MyController">
    Hello {{greetMe}}!
  </div>
  <script src="http://code.angularjs.org/snapshot/angular.js"></script>

  <script>
angular.module('myApp', [])
  .controller('MyController', ['$scope', function ($scope) {
    $scope.greetMe = 'World';
  }]);

angular.element(function() {
  angular.bootstrap(document, ['myApp']);
});
  </script>
</body>
</html>

Sample example on how to bootstrap an application

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.