part 2 Angular modules and controllers
What is a module in AngularJS?
A module is a container for different parts of your application i.e controllers,services,directives,filters,etc.
You can think of a module as a Main() method in other types of applications.
How to create a module?
Use the angular object's module() method to create a module.
var myApp = angular.module("myModule",[]);//the first parameter specify the name of module,the second parameter specify the dependence for the module,here i just set an empty array.
What is a controller in angular?
In angular a controller is a JavaScript function. The job of the controller is to build a model for the view to display.
How to create a controller in angular?
var myController = function($scope){
$scope.message="AngularJS Tutorial";
};
How to register the controller with the module?
myApp.controller("myController",myController); // 1 way
myApp.controller("myController",function($scope){ // 2 way
$scope.message="AngularJS Tutorial";
});

In js file , we can add a reference with angular.js to has some code tip.(autocomplete some angular member.)
part 2 Angular modules and controllers的更多相关文章
- [AngularJS] Lazy loading Angular modules with ocLazyLoad
With the ocLazyLoad you can load AngularJS modules on demand. This is very handy for runtime loading ...
- Calling unknown method: app\modules\mobile\controllers\CompanyController::redirect()
$this->redirect(['default/error']); Yii::$app->end();上边的代码出现 Calling unknown method: app\modul ...
- Angular概念纵览
Conceptual Overview Template(模板): HTML with additional markup (就是增加了新的标记的HTML) Directive(指令): extend ...
- (七)理解angular中的module和injector,即依赖注入
(七)理解angular中的module和injector,即依赖注入 时间:2014-10-10 01:16:54 阅读:63060 评论:1 收藏:0 [点 ...
- Angular JS中的依赖注入
依赖注入DI angularjs中与DI相关有angular.module().angular.injector(). $injector.$provide. DI 容器3要素:服务的注册.依赖关系的 ...
- Angular源代码学习笔记-原创
时间:2014年12月15日 14:15:10 /** * @license AngularJS v1.3.0-beta.15 * (c) 2010-2014 Google, Inc. http:// ...
- 理解angular中的module和injector,即依赖注入
理解angular中的module和injector,即依赖注入 依赖注入(DI)的好处不再赘言,使用过spring框架的都知道.angularjs作为前台js框架,也提供了对DI的支持,这是java ...
- 转: angular编码风格指南
After reading Google's AngularJS guidelines, I felt they were a little too incomplete and also guide ...
- 前端面试angular 常问问题总结
1. angular的数据绑定采用什么机制?详述原理 angularjs的双向数据绑定,采用脏检查(dirty-checking)机制.ng只有在指定事件触发后,才进入 $digest cycle : ...
随机推荐
- Windows Server 2012远程刷新客户端组策略,IE代理设置
Windows Server 2012远程刷新客户端组策略: 1.PowerShell命令对单台计算机进行刷新: Invoke-GPUpdate -RandomDelayInMinutes 0 -Co ...
- Codeforces Round #146 (Div. 1) A. LCM Challenge 水题
A. LCM Challenge 题目连接: http://www.codeforces.com/contest/235/problem/A Description Some days ago, I ...
- Looksery Cup 2015 B. Looksery Party 暴力
B. Looksery Party Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/549/pro ...
- C#实现一个最简单的HTTP服务器
简介 本文用C#实现了一个最简单的HTTP服务器类,你可以将它嵌入到自己的项目中,或者也可以阅读代码来学习关于HTTP协议的知识. 背景 高性能的WEB应用一般都架设在强大的WEB服务器上,例如IIS ...
- 搭建Spring + SpringMVC + Mybatis框架之三(整合Spring、Mybatis和Spring MVC)
整合Spring和SpringMVC 之前已经整合了spring和mybatis,现在在此基础上整合SSM. 项目目录: 思路:SpringMVC的配置文件独立,然后在web.xml中配置整合. (1 ...
- 关于去除Dialog的黑色背景框
Dialog有两种形式的,一个是Dialog及其子类,还有一种是Activity的Dialog显示方式. 不管怎样,在自定义Dialog的时候,如果不做一些处理,都会出现黑色背景边框,这个问题动不动就 ...
- 利用yum工具安装应用程序
在安装gtk+编译环境的过程中,你会发现,RPM软件包之间的依赖关系非常复杂.在实际管理过程中,这种依赖关系可能会更加复杂.因此非常有必要寻找一种自动化安装工具,让安装工具自己处理这些关系复杂的依赖关 ...
- c#怎么把byte转化成int
三种方法来进行转换.(1) 在.NET Framework类库的System名字空间中有个叫做BitConverter的类,它是专门用来进行这种转换的.主要方法:1> GetBytes()方法 ...
- eclipse中的tomcat debug模式启动报超时45s
在eclipse中加入tomcat,开debug模式非常好用,这里就不介绍了 最近eclipse的tomcat开debug模式就是启动不了,增加时间也不能解决,但是非debug模式就可以打开,我觉得是 ...
- java中set和get方法的理解
对于JAVA初学者来说,set和get这两个方法似乎已经很熟悉了,这两个方法是JAVA变成中的基本用法,也是出现频率相当高的两个方法. 为了让JAVA初学者能更好的理解这两个方法的使用和意义,今天笔者 ...