我想从模态(对话框:http ://angular-ui.github.io/bootstrap/ )中单独使用相同的控制器。但我不知道该怎么做
'use strict';
App.controller "ApplicationNewCtrl", ["$scope", "dialog", "Application", "$window", ($scope, dialog, Application, $window) ->
$scope.application = new Application()
$scope.create = ($event, application) ->
$event.preventDefault()
$scope.application.$save (result) ->
if dialog.isOpen()
dialog.close()
else
$window.location.href = "/applications/#{$scope.application.id}"
$scope.close = (result) ->
dialog.close(result)
]
因此,当我使用模式时,“对话框”被注入到我的控制器中,但是当我从路由器(独立)使用它时:
App.config(['$routeProvider', '$locationProvider' ,
($routeProvider, $locationProvider) ->
#$locationProvider.hashPrefix('');
$locationProvider.html5Mode true
# Applications
$routeProvider.when("/applications/new",
templateUrl: '/applications/new.html?l=false'
)
])
我有这个错误:
错误:未知提供程序:dialogProvider <- dialog
我怎样才能动态管理 inkections?我试图删除“对话”注入并按 $injector.get('dialog') 替换它,但它不起作用