I have a service that I want to pass into a Component in Angular 1.5. I'm not using Gulp or TypeScript.
This is the service:
(function() {'use strict'; angular.module('flavorApplication') .component('app', { templateUrl: "app/app.component.html", controllerAs: "vm", controller: function AppController() {
This is the Component:
(function() {'use strict'; angular.module('flavorApplication') .component('app', { templateUrl: "app/app.component.html", controllerAs: "vm", controller: function AppController('DataService')
This didn't work. I also tried:
controller: ['DataService', function AppController('DataService')
This also didn't work. Keep in mind I'm new to angular and just getting my feed under me. Thank you for your help!
您不需要单引号。
controller: function AppController(DataService)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.