Я хотел бы передать данные в модальный режим, не передавая все $ scope. Мой модал в компоненте.
angular.module('app').component('testModal', {
templateUrl: '/test-modal',
bindings: {
close: '&',
dismiss: '&',
resolve: '<'
},
controller: function ($scope, test) {
var vm = this;
this.test = test;
this.save = () => {
this.close()
}
this.cancel = function () {
this.dismiss()
}
}
})
Я пытаюсь передать данные, как показано ниже (от другого контроллера)
function openModal() {
testService.getTest().then(function(data) {
var modalInstance = $uibModal.open({
component: 'testModal',
size: 'lg',
resolve: {
test: function () {
return data;
}
}
})
})
}
Но у меня есть ошибка: angular.js:15567 Error: [$injector:unpr] Unknown provider: testProvider <- test <- catchError
Как с этим справиться ? Почему «тест» не читается в моем модальном компоненте?