angularjs - AngularUI modal custom scope -
i wanted define custom scope modal (i don't want use dependency injection reasons) using in project, i'm getting error whenever define scope in $modal.open
. here plunk created example on angularui's website: http://plnkr.co/edit/rbtbpyqg7l39q1qydhns
i tried debugging , saw (modaloptions.scope || $rootscope)
returns true
custom scope , since true
(obviously) doesn't have $new()
function defined, exception thrown.
any thoughts?
you'll have pass scope instance:
var modalinstance = $modal.open({ animation: $scope.animationsenabled, templateurl: 'mymodalcontent.html', controller: 'modalinstancectrl', size: size, resolve: { items: function () { return $scope.items; } }, scope: $scope });
you can pass own custom scope if don't want use controller's scope, working plnkr:
Comments
Post a Comment