我有一项服务,我想将它传递给 Angular 1.5 中的组件。我没有使用 Gulp 或 TypeScript。
这是服务:
(function() {'use strict';
angular.module('flavorApplication')
.component('app', {
templateUrl: "app/app.component.html",
controllerAs: "vm",
controller: function AppController() {
这是组件:
(function() {'use strict';
angular.module('flavorApplication')
.component('app', {
templateUrl: "app/app.component.html",
controllerAs: "vm",
controller: function AppController('DataService')
这没有用。我也试过:
controller: ['DataService', function AppController('DataService')
这也没有奏效。请记住,我是 Angular 的新手,只是让我的饲料在我身下。谢谢您的帮助!