嗨,我试图从Angular2-modal更新为ngx-modialog
之后,在Angular 6上运行此代码this.modal.confirm()
.showClose(true)
.title(this.translator.instant('common.message.confirm.delete'))
.keyboard(27)
.okBtn(this.translator.instant('common.text.yes'))
.cancelBtn(this.translator.instant('common.text.no'))
.message("<h5>" + this.translator.instant('common.message.confirm.deleteAll') + "</h5>")
.open()
.then(( d ) => d.result
.then(( r ) => {...});
但是编译后出现此错误:
Property 'then' does not exist on type 'DialogRef<TwoButtonPreset>'.ts(2339)
我尝试了这个,但是有同样的错误
...
dialog: DialogRef<TwoButtonPreset>;
...
let dialog = this.modal.confirm() .showClose(true)
.title(this.translator.instant('common.message.confirm.delete'))
.keyboard(27)
.okBtn(this.translator.instant('common.text.yes'))
.cancelBtn(this.translator.instant('common.text.no'))
.message("<h5>" + this.translator.instant('common.message.confirm.deleteAll') + "</h5>")
.open()
.then(( d ) => d.result
...
我也尝试过,但是得到; expected
this.modal.confirm()
.showClose(true)
.title(this.translator.instant('common.message.confirm.delete'))
.keyboard(27)
.okBtn(this.translator.instant('common.text.yes'))
.cancelBtn(this.translator.instant('common.text.no'))
.message("<h5>" + this.translator.instant('common.message.confirm.deleteAll') + "</h5>")
.open()
.result => {...};
这是我的package.json:
{
"name": "frontend6",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^6.1.0",
"@angular/common": "^6.1.0",
"@angular/compiler": "^6.1.0",
"@angular/core": "^6.1.0",
"@angular/forms": "^6.1.0",
"@angular/http": "^6.1.0",
"@angular/platform-browser": "^6.1.0",
"@angular/platform-browser-dynamic": "^6.1.0",
"@angular/router": "^6.1.0",
"@ngx-translate/core": "^12.1.2",
"@ngx-translate/http-loader": "^4.0.0",
"@types/alertify": "^0.3.29",
"@types/file-saver": "0.0.1",
"@types/highcharts": "^5.0.25",
"@types/jquery": "2.0.47",
"@types/openlayers": "4.6.9",
"ag-grid": "7.1.0",
"ag-grid-ng2": "7.1.2",
"angular-tree-component": "^3.7.3",
"angular2-google-maps": "0.17.0",
"angular2-infinite-scroll": "^0.3.4",
"angular2-text-mask": "2.1.0",
"angular2-toaster": "^8.0.0",
"angular2-tree-component": "2.0.0",
"animate.css": "^3.7.2",
"bootstrap": "3.3.7",
"chart.js": "^2.7.3",
"chroma-js": "^1.3.7",
"codemirror": "5.22.0",
"core-js": "^2.5.4",
"easy-pie-chart": "2.1.7",
"file-saver": "1.3.3",
"flot": "0.8.0-alpha",
"font-awesome": "4.7.0",
"fullcalendar": "3.1.0",
"highcharts": "^6.2.0",
"highcharts-stock": "^0.1.7",
"jqcloud2": "2.0.2",
"jquery": "^3.5.1",
"jquery-slimscroll": "1.3.8",
"jquery-sparkline": "2.4.0",
"jquery.browser": "0.1.0",
"jquery.flot.tooltip": "0.9.0",
"jspdf": "1.3.5",
"jspdf-autotable": "2.3.2",
"lodash": "^4.17.15",
"modernizr": "^3.11.1",
"moment": "^2.25.3",
"mydatepicker": "1.10.2",
"ng2-bootstrap": "1.1.16-11",
"ng2-charts": "^1.6.0",
"ng2-data-table": "1.0.0",
"ng2-dnd": "2.1.1",
"ng2-file-upload": "1.1.4-2",
"ng2-img-cropper": "0.7.7",
"ng2-select": "1.1.2",
"ng2-table": "1.3.2",
"ng2-tag-input": "0.7.0",
"ng2-validation": "3.1.3",
"ngx-modialog": "^5.0.1",
"openlayers": "3.20.1",
"rxjs": "~6.2.0",
"rxjs-tslint": "^0.1.8",
"screenfull": "3.0.2",
"simple-line-icons": "2.4.1",
"spinkit": "1.2.5",
"summernote": "0.8.2",
"ts-helpers": "1.1.1",
"weather-icons": "1.3.2",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-builders/jest": "^7.2.3",
"@angular-devkit/build-angular": "~0.8.0",
"@angular/cli": "~6.2.9",
"@angular/compiler-cli": "^6.1.0",
"@angular/language-service": "^6.1.0",
"@types/codemirror": "0.0.37",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/moment": "2.13.0",
"@types/node": "~8.9.4",
"codelyzer": "~4.3.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-read-json": "1.1.0",
"karma-remap-istanbul": "0.2.1",
"loaders.css": "0.1.2",
"napa": "2.3.0",
"protractor": "4.0.13",
"ts-node": "1.2.1",
"tslint": "4.0.2",
"typescript": "^2.4.2",
"webdriver-manager": "10.2.5",
"webpack": "^4.11.1",
"webpack-dev-server": "2.1.0-beta.9"
}
}
基本应用程序位于Angular 2上,我现在可以将其升级到Angular 4了,
答案 0 :(得分:1)
我想var numbers = 39 // not static numbers
int count = 0;
for(int i=0; i<=numbers; i++)
{
count++;
if (count == 20)
{
//Logic
count = 0;
}
}
不会返回Promise。尝试像这样添加${If} $WEB_VDir != ""
DetailPrint "Creating IIS website ..."
StrCpy $WEB_SiteCreatedBySetup 1
StrCpy $1 "$WEB_AppPool"
StrCpy $2 "rs" ; Read, Run scripts
StrCpy $3 "MyPage.svc"
StrCpy $4 "Grant All"
;StrCpy $5 "Ssl, SslNegotiateCert"
DetailPrint "go"
NsisIIS::CreateWebSite ;"$WEB_VDir" "$INSTDIR\inetpub" "*:8099:"
Pop $0
${If} $0 != "Create Website Success."
MessageBox MB_OK "Cannot create website $WEB_VDir ($0)!"
Abort
${EndIf}
${EndIf}
:
open()
(这是针对v4的)
答案 1 :(得分:1)
您需要引用dialogRef本身,
dialogRef.result
.then( result => alert(`The result is: ${result}`) );
答案 2 :(得分:0)
我通过在result
之前添加then
来解决它:
...
this.modal.confirm().showClose(true)
.title(this.translator.instant('common.message.confirm.delete'))
.keyboard(27)
.okBtn(this.translator.instant('common.text.yes'))
.cancelBtn(this.translator.instant('common.text.no'))
.message("<h5>" + this.translator.instant('common.message.confirm.deleteAll') + "</h5>")
.open()
.result
.then(( d ) => d.result
...