javascript - AngularJS UI-Bootstrap Modal -


below angular code not getting errors, model opens modalinstancectrl functions cancel() , ok() not want work, if right out controller have on angularjs ui-bootstrap (http://angular-ui.github.io/bootstrap/#/modal) directives website seems work.

i using same html in example on website except have extracted inline template own file, working.

package versions: bootstrap 3.1.1, angularjs 1.2.18, ui bootstrap 0.11.0

i think issue here include controller maybe not doing correctly

controller: this.modalinstancectrl, 

main app app.js:

'use strict'  angular.module('myapp', ['ui.bootstrap', myappcontrollers]); 

controllers controllers.js:

'use strict';  var myapp = angular.module('myappcontrollers', []);  myapp.controller('modalctrl', ['$scope', '$modal', '$log', function($scope, $modal, $log) {       $scope.open = function (size) {          var modalinstance = $modal.open({             templateurl: 'templates/mymodalcontent.html',             controller: this.modalinstancectrl,             size: size,             }         });          modalinstance.result.then(function (selecteditem) {             $scope.selected = selecteditem;         }, function () {         $log.info('modal dismissed at: ' + new date());       });     }; }]);  myapp.controller('modalinstancectrl', ['$scope', '$modalinstance', function($scope, $modalinstance) {      $scope.ok = function () {         $modalinstance.close();     };      $scope.cancel = function () {         $modalinstance.dismiss();     }; }]); 

ok found solution here:

calling controller within angularjs ui bootstrap modal

problem called controller must wrapped in single quotes:

controller: 'modalinstancectrl', 

credit chris southam


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -