美文网首页我爱编程
angular.bootstrap(document, [

angular.bootstrap(document, [

作者: 北漂老莫 | 来源:发表于2016-03-15 16:19 被阅读731次

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

    This will work if you have your scripts loaded at the end of the page (instead of in the header).

    Otherwise, the DOM will not be loaded at the time of bootstrapping the app(there won' t be any template to be compiled, the directives wont't have any effect).

    angular.bootstrap(angular.element("body")[0], ["TodoApp"]);
    The same as before, using body as the root of the application. It uses a selector that is not available in jqLite, so you need to have full jQuery included in the app

    angular.element(document).ready(function() {
      angular.bootstrap(document);
    })
    

    This one actually waits for the DOM to be loaded, so it will even if you include your scripts in the header.
    This is basically the same as jQuery's $(document).ready(), but using jqLite's angular.element.

    相关文章

      网友评论

        本文标题:angular.bootstrap(document, [

        本文链接:https://www.haomeiwen.com/subject/rlhqlttx.html