Classy清理工具
Classy 是為 AngularJS 基于類控制器的清理工具。示例代碼:
app.classy.controller({
name: 'MyCtrl',
inject: {
$scope: '$',
filterFilter: 'filter',
$location: '.'
},
init: function() {
// Check if dependencies are defined
console.log(this.$); // ? ChildScope {}
console.log(this.$scope); // ? undefined
console.log(this.$location); // ? LocationHashbangUrl {}
// Use a dependency
console.log(this.filter(
this.$.todos,
{ completed: true }
)); // [{"title":"Learn Angular","completed":true}]
}
});評(píng)論
圖片
表情
