2016-10-23 111 views
0

我想用angularjs使用webpack,但是无法让我的控制器工作,当我尝试要求它并运行它时出现此错误:__webpack_require__(...) is not a function。下面是我的app.js和控制器代码:需要带有webpack的AngularJs控制器

//app.js 
var angular = require('angular'); 
var weatherModule = angular.module('weather', []); 

require('./shared/directives/app.directives')(weatherModule); 
require('./weather/weather.controller')(weatherModule); 

//weather.controller.js 
module.export = function(weatherModule) { 
    weatherModule.controller('WeatherCtrl', ['$scope', function($scope){ 
     $scope.greetings = 'Hey from controller'; 
    }]); 
} 

如果我直接写控制器代码在app.js本身工作正常,如:weatherModule.controller('WeatherCtrl', ['$scope', function($scope){}])

回答

0

这是错字的错误,它应该是module.exports代替export