1

i have recently started a project and using webpack as build tool.

angular.module('app')
.controller('appController', require('./src/appController'));

and my appcontroller.js looks like

'use strict';
var appController = function($scope){
    $scope.name = 'hello';
};
appController.$inject(['$scope']);
module.exports = appController;

bundel is being formed at desired location, problem is when i use the function.$inject for dependency injection, as i want my code to get uglify, i gets browser error when i runs my app

appController.$inject is not a function

This is first time i'm experiencing the error as i'm using webpack?

navtej singh
  • 277
  • 3
  • 11

1 Answers1

0

$inject is not a function, it's property. It should be:

appController.$inject = ['$scope'];
dfsq
  • 191,768
  • 25
  • 236
  • 258