Thursday 15 April 2010

angularjs - cannot change the syntax of the controller creation in typescript -



angularjs - cannot change the syntax of the controller creation in typescript -

i have angular controller wrote in typescript , declared way

angular.module('myapp').controller("gestioneprogetto", ["$scope", "palmariservice", "soluzioniservice", "progettoservice", "wmsservice", "bingservice", "$modal", "settoreservice", ($scope, dispositivi, soluzioni, progetti, wms, bing, modal, settore) => new palmare.controllers.gestioneprogetto($scope, dispositivi, soluzioni, progetti, wms, bing, modal, settore)])

and working fine. want alter removing here di references, moving

static $inject = ["$scope", "palmariservice", "soluzioniservice", "progettoservice" , "wmsservice", "bingservice", "$modal", "settoreservice"];

and changing

angular.module('myapp').controller("gestioneprogetto", ($scope, dispositivi, soluzioni, progetti, wms, bing, modal, settore) => new palmare.controllers.gestioneprogetto($scope, dispositivi, soluzioni, progetti, wms, bing, modal, settore));

this approach worked fine factoriesi changes, trying first controller doing obtain message

error: [$injector:unpr] unknown provider: dispositiviprovider <- dispositivi

am missing something?

in case definition this:

module palmare.controllers { export class gestioneprogetto { static $inject = ["$scope", "palmariservice", "soluzioniservice", ...]; ...

this should work angular:

angular .module('myapp') .controller("gestioneprogetto", palmare.controllers.gestioneprogetto);

angularjs typescript

No comments:

Post a Comment