zoukankan      html  css  js  c++  java
  • [AngualrJS] ng-strict-di

    In Angular 1.5 introduces "compoment" syntax. But ng-annotate doesn't understand ".compoment" syntax, that's why in min version, the code doesn't work.

    so use "ng-strict-di" directive, it tell AngualrJS when compile time to check whether the dependciy injection is working or not.

      <body ng-app="app" ng-strict-di ng-cloak>
    
        <app>
          Loading...
        </app>
    
        <script src="bundle.js"></script>
      </body>

    Then we when use compoment, if we don't add 'ngInject', then it will block the compiler, so everytime we use component, we need to add:

    class CategoriesController {
      constructor(CategoriesModel) {
        'ngInject';
    
        CategoriesModel.getCategories()
          .then(categories => this.categories = categories);
      }
    }
    
    export default CategoriesController;
  • 相关阅读:
    HDU
    POJ
    快速幂运算
    RocketMQ集群
    RocketMQ角色介绍
    RocketMQ初探
    MySQL 串行隔离级别小记
    分布式事务笔记
    MySQL分库分表篇
    MySQL主从篇
  • 原文地址:https://www.cnblogs.com/Answer1215/p/5839826.html
Copyright © 2011-2022 走看看