zoukankan      html  css  js  c++  java
  • angularjs的懒加载

    1angularJS懒加载依赖模块

    //设置

    .config [

          '$ocLazyLoadProvider'

          ($ocLazyLoadProvider) ->

            # We configure ocLazyLoad to use the lib script.js as the async loader

            $ocLazyLoadProvider.config

              debug: true

              events: true

              modules: [

                {

                  name: 'ui.grid'

                  files: [

                    '//cdn.bootcss.com/angular-ui-grid/3.1.1/ui-grid.js'

                  ]

                }

              ]

            return

        ]

    //路由

    .state 'admin.user.123', {

          url: '123/'

          templateUrl: '123.html'

          controller: '123Ctrl'

          resolve: {

            deps: ['$ocLazyLoad',

              ($ocLazyLoad)->

                return $ocLazyLoad.load('ui.grid').then(

                  ()->

                    return $ocLazyLoad.load('123Ctrl.js')

                )

            ]

          }

          data: {title: '123'}

    }

  • 相关阅读:
    Python阶段复习
    Python阶段复习
    Python学习笔记
    Python爬虫学习
    Python爬虫学习
    Python学习笔记
    史上最全的Maven Pom文件标签详解
    css3 animation动画技巧
    常用的sass编译库
    compass做雪碧图
  • 原文地址:https://www.cnblogs.com/sxz2008/p/6287902.html
Copyright © 2011-2022 走看看