ocombe / ocLazyLoad

Lazy load modules & components in AngularJS
https://oclazyload.readme.io
MIT License
2.63k stars 510 forks source link

$ocLazyLoad loads my controller several times #327

Closed davidwillianx closed 8 years ago

davidwillianx commented 8 years ago

Hello, Im include my controller using $stateProvider

 `state.('dash.home', {
  controller: 'MainCtrl',
  templateUrl: '/assets/ng-app/views/dashboard/home.html',
  resolve: {
    loadMyFiles: function ($ocLazyLoad) {
      return $ocLazyLoad.load({
       name: 'sbAdminApp',
      files: [
      "/assets/ng-app/controller/main.js",
      "/assets/ng-app/factories/chartFactory.js",
       ]})
    }
  });

//Controller
app.module('myApp').controller('MainCtrl', function(){
     //shows several times (3x)
     console.log('calling controller');
});

`