Comments (1)
1.ng-app
指令定义一个AngularJS应用程序
var app = angular.module("angularDemo", []);
2.ng-controller
指令定义了应用程序控制器,控制作用域
app.controller('studentCtrl', function($scope, $rootScope) {
//数据操作
})
解决压缩的一种写法,把他整个传回调函数的过程,改写成数组的形式存放
app.controller('studentCtrl', ['$scope', '$rootScope',function($scope, $rootScope) {
//数据操作
}])
3.$scope
为控制器作用域、控制范围内生效的对象,只在所在的控制器生效
$scope.wsscat = 'a';
$scope也是应用在HTML(视图)和JavaScript(控制器)之间的纽带,实现单向绑定
HTML(视图)就可以用{{wsscat}}渲染数据
4.表达式的{{}}
双大括号或者’ng-bind‘
把数据绑定到HTML(视图上)
{{a}}
<p ng-bind="a">
5.管道字符(|)给表达式{{}}添加过滤器
例如{{wsscat|uppercase}}
,{{money|currency:'&'}}
6.ng-model
输入结果,并把结果传递给对应控制器中$scope
<input ng-model="wsscat" value="" />
实现双向绑定
from angular-tutorial.
Related Issues (20)
- angular cdn
- ui-route和ng-route HOT 3
- $cacheFactory
- ionic总结 HOT 1
- ng-cookie
- ng-repeat绑定事件和嵌套
- ng-repeat嵌套
- service demo HOT 2
- Angular API文档
- directive demo HOT 1
- angular面试题 HOT 3
- AngularJS开发人员最常犯的10个错误
- 求指教阿!! HOT 1
- Angular中的MVC模型
- Angular的post请求后台接受不了数据的解决方法
- angular2
- 引入多个angular.js时候,angular程序会出错
- Angular指令(directive)中的controller,compile,link函数有什么不同?
- angular4
- angular4+webpack
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-tutorial.