博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Angularjs 中的 controller
阅读量:7030 次
发布时间:2019-06-28

本文共 669 字,大约阅读时间需要 2 分钟。

接触过程序开发的小伙伴们对 MVC 的开发方式想必一点也不陌生,是的, angularjs 所採用的方式便是 MVVM 的开发方式,这里的 controller 即控制器

了解 controller

The ngController directive attaches a controller class to the view. This is a key aspect of how angular supports the principles behind the Model-View-Controller design pattern.

译文:

ngController 是关注于视图 controller 的一个指令

指令的基本信息

This directive creates new scope.This directive executes at priority level 500.

译文:

指令会创建一个 scope 即作用域

什么时候使用 controller

当我们须要一个新的模块而且不希望它跟其它模块的数据产生冲突的情况下。我们就能够使用一个 ngController 来独立这一块的内容,比方我们的文章正文模块能够使用 ng-controller=”AricleController”。而文章中的评论模块则能够使用 ng-controller=”CommentController” 来完毕

转载于:https://www.cnblogs.com/clnchanpin/p/7354966.html

你可能感兴趣的文章
HDU 1205
查看>>
Openstack-L 路由注入方式
查看>>
利用ROS工具从bag文件中提取图片
查看>>
Java常用类库
查看>>
Android开发之Activity转场动画
查看>>
List集合三种遍历方法
查看>>
【译】OpenDaylight控制器:YANG Schema和Model
查看>>
C#访问修饰符(public,private,protected,internal,sealed,abstract)
查看>>
android消息线程和消息队列
查看>>
EXCEL中计算不重复单元格的个数
查看>>
二层设备与三层设备的区别--总结
查看>>
安装pytorch成功但cuda不可用
查看>>
unity__DrawCall的理解
查看>>
springboot架构下运用shiro后在configuration,通过@Value获取不到值,总是为null
查看>>
SQLServer 数据库镜像+复制切换方案
查看>>
Postman初探
查看>>
仿淘宝头像上传功能(一)——前端篇。
查看>>
Eclipse通过集成svn实现版本控制
查看>>
OS开发过程中常用开源库
查看>>
关于在多个UItextield切换焦点
查看>>