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'])
  • 相关阅读:
    Centos 实现SSH证书登录
    Spring Boot 拦截器的使用
    Spring Boot 内置定时器的使用
    Spring Boot 整合Druid数据源(一)
    Spring Boot 整合滑动验证
    asp.ent core swagger
    Dapper.Contrib
    SonarQube
    Endpoint.Binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport)
    wcf messageEncoding="Mtom"
  • 原文地址:https://www.cnblogs.com/Answer1215/p/9551865.html
Copyright © 2011-2022 走看看