什么是引导在角JS是什么意思? [英] What is meant by Bootstrapping in angular JS?

查看:128
本文介绍了什么是引导在角JS是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在角JS初学者。我打算通过下面的链接。
http://docs.angularjs.org/tutorial/step_00

I am a beginner in Angular JS. I was going through the below link. http://docs.angularjs.org/tutorial/step_00

什么是引导文件?它们位于何处?

什么是自动启动和引导的手动初始化?我读了手动初始化的缺点如下..从链接 http://docs.angularjs.org/guide/bootstrap
任何人都可以请解释一下究竟是什么缺点吗?

What is automatic booting and manual initialization of bootstrapping? I read the disadvantage of manual initialization as below.. from the link http://docs.angularjs.org/guide/bootstrap Can anyone pls exactly explain what is the disadvantage here?

推荐答案

虽然上面每个人都有完美的回答,我发现我一直在寻找,但仍然是一个工作的例子似乎丢失了。

Though Everyone above has answered perfectly and I found what I was looking for but still a working example seem missing.

虽然理解,请在下面的例子AngularJS自动/手动引导可以帮助很多:

While understanding about Auto / Manual bootstrapping in AngularJS below examples can help a lot :

AngularJS:自动引导过程:

<html>

    <body ng-app="myApp">
        <div ng-controller="Ctrl">Hello {{msg}}!</div>
        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>
        <script>
            var app = angular.module('myApp', []);
            app.controller('Ctrl', function($scope) {
                $scope.msg = 'Nik';
            });
        </script>
    </body>

</html>

的jsfiddle: http://jsfiddle.net/nikdtu/ohrjjqws/

AngularJS - 手动自举:

<html>

    <body>
        <div ng-controller="Ctrl">Hello {{msg}}!</div>
        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>
        <script>
            var app = angular.module('myApp', []);
            app.controller('Ctrl', function($scope) {
                $scope.msg = 'Nik';
            }); 
            //manual bootstrap process 
            angular.element(document).ready(function () { angular.bootstrap(document, ['myApp']); });
        </script>
    </body>

</html>

的jsfiddle: http://jsfiddle.net/nikdtu/umcq4wq7/

这篇关于什么是引导在角JS是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆