Watching changes in typeahead [angularjs+bootstrap] -


i have 2 typeahead .first 1 shows account groups .

second 1 should show ledgers listed based on selection of first typeahed.

this first typeahead

 <input type="text" class="form-control" required ng-model="newitem.customselected1" typeahead="account_group account_group.group_name account_group in account_groups | filter:{group_name:$viewvalue}"/> 

this second typeahead.

 <input type="text" class="form-control" required ng-model="newitem.customselected2" typeahead="ledger ledger.ledger_name ledger in ledgers | filter:{ledger_name:$viewvalue}"/> 

i have tried ng-change not provide me solution.

update

i have tried this

$scope.$watch("newitem.customselected1", function (newitem.customselected1) {     if(newitem.customselected2='abc')     console.log(newitem.customselected2);       }); 

but not giving te solution. please help

something should work:

<input type="text"        class="form-control"        required        ng-model="newitem.customselected2"        typeahead="ledger ledger.ledger_name ledger in ledgers | filter:newitem.customselected1.ledger | filter:{ledger_name:$viewvalue}"/> 

or depending on how structure data good

<input type="text"        class="form-control"        required        ng-model="newitem.customselected2"        typeahead="ledger ledger.ledger_name ledger in newitem.customselected1.ledgers | filter:{ledger_name:$viewvalue}"/> 

but depends in part on data model, including more concrete answer. including plunkr show problems in action better:

http://plnkr.co/edit/tpl:frtqqtnoy8befhs9bb0f


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -