【发布时间】:2017-04-12 05:21:19
【问题描述】:
我正在尝试使用 $uibModal 使用 typescript 和 angular 来显示模式。
export class PDPController{
static $inject = ['pdpService', '$sce', 'angularLoad', '$uibModalInstance'];
constructor(
pdpService: PDPService,
$sce : ng.ISCEService,
angularLoad,
//initiating in constructor
private $uibModalInstance:ng.ui.bootstrap.IModalServiceInstance
) {
this.pdpService=pdpService;
//Need to add promise
pdpService.getContentdata(APP_CONSTANT.API_URL_LEARN_MORE)
.then((authorContentData) => {
this.contentData= authorContentData;
pdpService.getPDPdata(APP_CONSTANT.API_URL_LEARN_MORE)
.then((pdpData) => {
console.log(pdpData);
this.setProductDetails(pdpData);
});
});
}
//method to invoke the modal
private showPromo(): void{
console.log("Promo");
var modalInstance = this.$uibModal.open({
animation: "true",
templateUrl: 'promoModalContent.html',
appendTo: 'body'
});
}
}
//module:
let module: ng.IModule = angular.module(pdpModule, ['ui.bootstrap']);
我在运行 Gulp Build 时遇到了这个错误:
Unknown provider: $uibModalInstanceProvider <- $uibModalInstance
Module 'angular.ui' has no exported member 'bootstrap'.
$uibModal 在我运行代码时无法识别: 错误:“PDPController”类型上不存在属性“$uibModal”。
我对 Typescript 完全陌生,无法找到出路。 请指导。
【问题讨论】:
标签: angularjs typescript angular-ui-bootstrap