0

I have problem in load on demand controller js file with ui-router and error me:

Argument 'FormController' is not a

My code is:

'use strict';

var Request = angular.module('Request',['ui.router','oc.lazyLoad'])
    .config(function($stateProvider) {
        $stateProvider.state('form', {
            url: "/form",
            templateUrl: "view/form1.html",
            controller:'FormController as form',
            resolve: {
                form: function( $ocLazyLoad ){
                    return $ocLazyLoad.load(
                        {
                            name:'form',
                            files:['app/controller/FormController.js']
                        }
                    )
                }

        }
    });

and my controller is:

'use strict';

Request.controller('FormController',function($scope){
    $scope.text = 'This is Form Controller';
})

1 Answer 1

2

I solved problem with this solution:

Change app.controller to angular.module('myApp').controller

https://github.com/ocombe/ocLazyLoad/issues/182

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.