javascript - ng-include scope issue without changing template -


there select box in template looks this:

<form name="myform" class="fixed-select">    <select name="repeatselect" id="repeatselect"             ng-model="selecteditem">       <option ng-repeat="program in programs"               value="{{program.name}}">          {{program.name}}       </option>    </select> </form> 

my template this:

<div ng-include="'/views/program/program.html'"></div> 

now, in controller (let's call myctrl) can set selecteditem , cause right thing load:

$scope.selecteditem = "manage"; 

but when using selectbox manually nothing happens, believe it's not tied parent's scope (the current controller (myctrl) of template ng-include).

i've been searching how fix this, , few options mention changing template include $parent or something. necessary? hoping ng-include great way encapsulate existing data use again no modifications. have hook ng-include scope controller (myctrl)?

thank time , patience in reading this.

edit1: 'programs' select box populated array of strings: ["main","etc"]

it turns out should have created object inherit from. instead of $scope.selecteditem in controller , selecteditem in template, used $scope.model.selecteditem , model.selecteditem respectively.

i learned another issue on stack overflow.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -