angularjs - ui-bootstrap modal scope bug -
i noticing weirdness ui-bootstrap modal scope. seems when using ng-model in it, have reference $parent scope of modal controller. notice in plunker other properties such ng-options doesn't require $parent: http://plnkr.co/edit/xgshz4ekzvgr2d6cuebz?p=preview
any idea why? found similar issue here: scope issues angular ui modal
that led me try $parent change unable comment on thread because don't have enough reputation.
any idea why scope seems change?
thanks!
the modal has own scope (i've never used angular ui, it's thing can happening) , when you're setting "selectedlocation" property getting set on modal's scope , not controller's scope. $parent forcing got controller's scope, that's not solution because you'll locking self structure assuming parent of modal has "model".
here's modified plunker using model object on controller scope (using model.selectedlocation) http://plnkr.co/edit/b5kzaia5xi2rediutbk7?p=preview
anyways, if put property on "$scope.model.selectedlocation" changes behavior. now, when reference "model.selectedlocation" on modal, modal's scope doesn't have model object angular goes scope chain controller's scope (which have model object).
watch video john lindquist, think can explain better can. :-) http://egghead.io/lessons/angularjs-the-dot
Comments
Post a Comment