AngularJS非常适合单页应用程序是什么意思? [英] AngularJS is perfect for Single Page Applications what is the meaning?

查看:89
本文介绍了AngularJS非常适合单页应用程序是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AngularJS非常适合单页应用程序(SPA).我是angularjs的新手,这是我遇到的第一条声明.这是什么意思?

AngularJS is perfect for Single Page Applications (SPAs). I'm new to angularjs and this is the first statement I came across. What does this mean?

推荐答案

SPA 是单页应用程序,浏览器在其中加载整个页面一次,并根据用户在交互过程中的请求.

SPA is a Single Page Application where the browser loads the entire page once and refreshes part(s) of the page based on the request by the user during interaction.

现在,我们将看看AngularJS的优势,

双向数据绑定::更改数据后,视图将自动刷新,这意味着我们无需再次加载整个页面.

Two-way-Data Binding: When ever data is changed the view automatically refreshes which means we don't need to load the entire page again.

控制器:您可以使用控制器将逻辑仅限制在视图的特定部分.这使得视图范围仅引用特定的控制器.这是控制SPA的简便方法.

Controllers: You can confine your logic only to particular part of the view using controllers. Which makes the view scope refer to only particular controller. This is brillinat way to control SPA.

服务: 这些是单例对象,仅在应用程序加载时实例化一次.

Services: These are singleton objects which are instantiated only once when the application loads.

指令:指令是自定义窗口小部件.我们创建它们一次,然后在需要的地方使用它们.

Directives: Directives are custom widgets. We create them once and use them where ever we need.

路由:根据用户请求切换视图.

Routing: Switching views based on the user request.

依赖关系注入:AngularJS具有内置的依赖关系注入.您只需要说出您需要的内容,Angular就会为您安排.一个简单的例子是,当您需要在Controller中具有多个功能,然后将服务注入到控制器中并继续进行业务逻辑处理时.

Dependency Injection: AngularJS has a built-in dependency injection. You just need to say what you need and angular will arrange you that. A simple example is when you need severice functionalities in your Controller then just inject you service in your controller and proceed with the business logic.

MVC :使用AngularJS,我们可以在客户端具有模型,视图,控制器体系结构.

MVC: Using AngularJS we can have Model, View, Controller architecture on the client side.

还有更多

这是AngularJS非常适合单页应用程序的一些原因.

These are some of the reasons why AngularJS is perfect for Single Page Applications.

有关SPA和AngularJS的更多详细信息,请参见以下精彩的视频.

Refer this wonderful video for more details on SPA and AngularJS.

这篇关于AngularJS非常适合单页应用程序是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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