zoukankan      html  css  js  c++  java
  • Angularjs 中的 controller

    接触过程序开发的小伙伴们对 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” 来完毕

  • 相关阅读:
    cocos2dx打包apk
    cocos2d 小游戏
    排序算法笔记二
    把一张合成图分拆出各个小图
    出栈入栈动画demo
    Android 面試題
    AS项目删减打包-01
    c程序指针题
    ubuntu14.04 设置默认登录用户为root
    Ubuntu14.04 Java环境变量配置
  • 原文地址:https://www.cnblogs.com/clnchanpin/p/7354966.html
Copyright © 2011-2022 走看看