zoukankan      html  css  js  c++  java
  • [AngularJS] ocLazyLoad -- Lazy loaded module should contain all the dependencies code

    Recentlly works with AngularJS + ocLazyLoad, our project have break down into multi small modules. For example

    mainApp module

      | -- vendor module

      | -- child 1 module

      | -- child 2 module

      | -- ....

    'vendor, child1, child2' they are spreated npm modules.

    'vendor' contains all the common used libs. Because we have multi AngularJS projects on going, vendor module is shared among all of them.

    One problem I met when apply lazy loaded is that, for example, I want to lazy load Child1 module, any child 1 module contains a lib call angular-scroll which locates in vendor module. And mainApp Module doesn't use angular-scroll lib.

    angular.module('Child1', ['duScroll'])

    When I lazy load Child1, it reports error that:

    'duScroll'Provider' is not found

    Because Child1 doesn't have this lib included, this lib was included in vendor module, ocLazyLoad requires:

    lazy loaded modules should contains all the dependencies code, unless the dependencies was already declare in main app module

    So the solution to solve the problem is include 'duScroll' into mainApp module:

    angular.module('mainApp', ['duScroll'])
  • 相关阅读:
    【PowerOJ1736&网络流24题】飞行员配对方案问题(最小割)
    MySQL的锁机制
    Hadoop相关基础知识
    ICMP基础知识
    关于CPU的一些基础知识
    关于内存的一些基础知识
    MySQL查询优化
    MapReduce初探
    压缩解压缩相关基础知识
    后台服务相关基础知识
  • 原文地址:https://www.cnblogs.com/Answer1215/p/9551865.html
Copyright © 2011-2022 走看看