I don't know which version of Angular -ui was, but the documentation for modal windows remains confusing. Although you can actually use the ngInclude directive as part of showing a modal window, this is optional, as shown below. In the case below, the modal html and script are in separate files, and modal.open () is used to reference and display them. For some reason, I was able to process the updated model only when it was passed as a property of the $ scope .. object (see "Vm." In the code)
Modalist .html
<input ng-model='vm.email' type='email' placeholder='Email address' autofocus /> <input ng-model="vm.password" type="password" class="form-control" placeholder="Password" /> <label class="checkbox"> <input ng-model="vm.rememberMe" type="checkbox" /> Remember me </label>
Debugger ModalViewCtrl.js
angular.module('app') .controller('ModalViewCtrl', function($scope, $modal, parms) { $scope.ok = function () { $modalInstance.close($scope.vm); }; $scope.cancel = function () { $modalInstance.dismiss(); }; });
SourcePageCtrl.js source parameter
angular.module('app') .controller('SourcePageCtrl', function($scope, $modal, ...) { $scope.open = function() { var modalInstance = $modal.open({ templateUrl: 'path_literal_to_ModalView.html' ,controller: 'ModalViewCtrl' ,resolve : { parms : function() { return { parms1 : value1 ,parm2 : value2 ,... }} }); modalInstance.result.then( function (vm) { $scope.result = vm; } , function () { ... } ); }); });
If you want to use include, however, there are two errors.
source share