ngDialog-弹出窗口未更新范围变量
ngDialog - popup not updating scope variable
我正在从ngDialog弹出窗口更新一个范围变量。
视图:
<input type="radio" name="file_selector" value={{file.id}} ng-model="selected_file.id" ></input>
controller.js
$scope.selected_file = {'id' : '22'};
如果我在非弹出HTML中有上面的视图,ng模型更新和视图更改。
ngDialog:
$scope.openUploadPopup = function() {
ngDialog.open({
template: 'partials/upload.html',
controller: 'notificationController',
className: 'ngdialog-theme-default',
scope: $scope
});
}
编辑:Plunker:http://plnkr.co/edit/8TUtwixKwvVaycDuvHd9?p=preview
我更改了你的文件,对我有用。
HTML:
<html>
<head>
<script src="https://code.angularjs.org/1.4.0-beta.6/angular.js"></script>
<script src="http://likeastore.github.io/ngDialog/js/ngDialog.min.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body ng-app="notifications_web_portal" ng-controller="notificationController">
<div ng-view>
<h1>Hello Plunker!</h1>
<span> File selected : {{selected_file.id}}</span>
<a href='javascript:void(0)' ng-click="openUploadPopup()" >Open Dialog</a>
</div>
</body>
</html>
JS:
// Code goes here
var notifApp = angular.module('notifications_web_portal', ['ngDialog']);
notifApp.controller('notificationController', function($scope, $rootScope, $window , ngDialog) {
$scope.openUploadPopup = function() {
ngDialog.open({
template: '<input type="radio" name="file_selector" value="87" ng-model="selected_file.id" ></input>',
controller: 'notificationController',
plain: true,
className: 'ngdialog-theme-default',
scope: $scope
});
}
});
完成的更改:
- 添加
plain: true
notifApp.controller('notificationController',......
相关文章:
- ngDialog-弹出窗口未更新范围变量
- 无法使用编程加载的属性更新范围滑块.js
- 角度文件上传更新范围在完成项上
- AngularJS摘要周期偶尔无法更新范围
- Angular:从工厂更新范围不起作用
- NG模型对我来说是矫枉过正的.任何仅在单击按钮时更新范围的替代方案,而不是每次都更新范围
- Angularjs 可编辑的字体头不更新范围
- 通过选中复选框更新范围
- 如何更新范围值
- 事件的角度更新范围
- 角度不更新范围更改时的模板
- 更新范围时不调用 Angular 指令
- AngularJS更新范围$q
- 如何动态更新范围滑块
- 尝试使用Firebase facebookconnect和AngularJS更新范围变量时出现问题
- Angular ng src在更改图像源时不更新范围
- 在$index达到某个数字后更新a范围值
- Angular-当Factory数据发生更改时更新范围
- 在视图中使用compile in指令和ng repeat的组合会阻止正确更新范围元素列表
- AngularJS,在指令的传入内容内分配与更新范围时的不一致's的孤立范围