-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Angular.js #70
Comments
factory / service / provider
一个service是一个单例对象, 由 例如 那么
简单来说 angular.module('app', [])
.factory('foo', function(){
return {
hello: 'world'
};
})
.service('bar', function(){
this.hello = 'world';
})
.provider('xyz', function(){
this.$get: function(){
return {
hello: world
};
};
}) |
实例https://github.com/dalelotts/angular-bootstrap-datetimepicker v0.3.14
|
过滤器https://docs.angularjs.org/api/ng/filter 使用{{ data | date: 'yyyy-MM-dd' }}
常用过滤器
自定义
|
directive 指令内置的 directiveng-repeat
ng-bind
实现的是绑定 ng-bind-template绑定多个表达式
ng-cloak在含有模板的元素上使用, 渲染好了就可以显示出来, 避免闪烁 ng-model双向绑定 ng-show / ng-hide根据表达式来确定是否显示 ng-click / ng-change / ng-submit事件 ng-options用在 ng-class
ng-attr-(suffix)某些元素在
会生成
|
自定义指令app.directive('fooBar', function(){
return {
restrict: String,
priority: Number,
terminal: Boolean,
template: String or Template Function:function(tElement, tAttrs) (...},
templateUrl: String,
replace: Boolean or String,
scope: Boolean or Object,
transclude: Boolean,
controller: String or
function(scope, element, attrs, transclude, otherInjectables) { ... },
controllerAs: String,
require: String,
link: function(scope, iElement, iAttrs) { ... },
compile: function(tElement, tAttrs, transclude) {
return {
pre: function(scope, iElement, iAttrs, controller) { ... }, 17
post: function(scope, iElement, iAttrs, controller) { ... }
}
// 返回一个对象 or 连接函数
return function postLink(...) { ... }
}
};
});
|
|
No description provided.
The text was updated successfully, but these errors were encountered: