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'])
  • 相关阅读:
    几何变换
    图片移动、旋转、resize、
    load、display、save
    java基础—java三大集合ArrayList、HashSet、HashMap
    java基础—修饰符、抽象类、接口
    java基础——转义字符
    java基础—String类型常用api
    Python中 sys.argv[]的用法
    Java—this关键字
    在CMD中运行Python文件
  • 原文地址:https://www.cnblogs.com/Answer1215/p/9551865.html
Copyright © 2011-2022 走看看