AngularJS 中使用 AngularUI Bootstrap Modal 的范围问题 [英] Scope issue in AngularJS using AngularUI Bootstrap Modal
本文介绍了AngularJS 中使用 AngularUI Bootstrap Modal 的范围问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
plunker:http://plnkr.co/edit/wURNg8ByPYbEuQSL4xwg
example.js:
angular.module('plunker', ['ui.bootstrap']);var ModalDemoCtrl = 函数($scope,$modal){$scope.open = 函数 () {var modalInstance = $modal.open({templateUrl: 'modal.html',控制器:'ModalInstanceCtrl'});};};var ModalInstanceCtrl = function ($scope, $modalInstance) {$scope.ok = 函数 () {警报($scope.text);};$scope.cancel = 函数 () {$modalInstance.dismiss('cancel');};};
index.html:
<html ng-app="plunker"><头><script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.js"></script><script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.6.0.js"></script><script src="example.js"></script><link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">头部><身体><div ng-controller="ModalDemoCtrl"><button class="btn" ng-click="open()">打开我!</button><div ng-show="selected">从模态中选择:{{ selected }}</div>