las*_*weq 3 javascript angularjs
我在我的项目中使用https://github.com/simpulton/angularjs-wizard,它有效,(我稍微修改了一下,替换var app为$scope)
但我需要将一个变量传递给open函数:
$scope.open = function (image)
{
$scope.image = image;
var modalInstance = $uibModal.open({
templateUrl: 'wizard.html',
controllerAs: 'modal',
size: 'lg',
controller: 'ModalCtrl',
resolve: {
image: function () {
return image;
}
}
});
modalInstance.result
.then(function (data) {
$scope.closeAlert();
$scope.summary = data;
}, function (reason) {
$scope.reason = reason;
});
};
Run Code Online (Sandbox Code Playgroud)
并在 html 中:
ng-click="open(image)"
Run Code Online (Sandbox Code Playgroud)
但image就是undefined在我的模板
如果我只是模态窗口,它就可以工作,示例来自https://angular-ui.github.io/bootstrap/#/modal,但不适用于此向导示例
更新:
https://jsfiddle.net/Ginstay/znz64sk3/2/
是的,当我打开模态窗口时,ajax 已完成
如果我向return image;图像添加断点就在那里
试试这个
angular.module('plunker', ['ui.bootstrap']);
var ModalDemoCtrl = function ($scope, $modal) {
var modalInstance = $modal.open({
templateUrl: 'myModalContent.html',
controller: ModalInstanceCtrl,
resolve: {
test: function () {
return 'test variable';
}
}
});
};
var ModalInstanceCtrl = function ($scope, $modalInstance, test) {
$scope.test = test;
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6210 次 |
| 最近记录: |