How to define controllers in multiple files - AngularJs

前端 未结 4 1207
深忆病人
深忆病人 2021-02-03 23:37

I am trying to define controllers in separate files, but I\'m getting the error:

transactionsController not a function got undefined

4条回答
  •  时光取名叫无心
    2021-02-03 23:50

    Load your common.js first. Move ng-app directive to tag. Change transaction.js to:

    app.controller('transactionsController', TransactionsController)
    
    TransactionsController.$inject = ['$scope','$http']
    
    function TransactionsController($scope, $http) {
    
    
    };
    

    Just for fun. Let me know what happens.

提交回复
热议问题