Classy清理工具

联合创作 · 2023-09-22 10:22

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}]
  }
});
浏览 5
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报