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'])
  • 相关阅读:
    耶鲁大学——斯金纳理论基础
    耶鲁大学——弗洛伊德(基础)
    for input 'WID' 报错
    选中当前行wid
    微信支付
    vue.js列表渲染项目实例
    批量删除
    DIV 局部刷新
    DIV块刷新
    CMD DOS命令
  • 原文地址:https://www.cnblogs.com/Answer1215/p/9551865.html
Copyright © 2011-2022 走看看