ionic 框架
1.引用
index.html 加载 <script type="text/javascript" src="lib/oclazyload/ocLazyLoad.min.js"></script>
2.注入
angular.module(‘starter‘, [‘ionic‘, ‘oc.lazyLoad‘])
3.配置
.state(‘app.myinfo‘, { url: ‘/user/myinfo‘, views: { ‘menuContent‘: { templateUrl: ‘templates/user/myinfo.html‘, controller: ‘myinfoCtrl‘ } } , resolve: { // Any property in resolve should return a promise and is executed before the view is loaded loadMyCtrl: [‘$ocLazyLoad‘, function ($ocLazyLoad) { // you can lazy load files for an existing module return $ocLazyLoad.load([‘js/controllersuser.js‘, ‘js/directive.js‘]); }] } })
时间: 2024-10-26 11:03:38