0

I have an array of objects that I use for auto complete, I can successfully make the auto-complete work. Now I also want get masterId from the object(of selected business name) and add it to a div. Im a newbie in Angularjs

<div class="">

  <script type="text/ng-template" id="customTemplate.html">
     <a>
     <span bind-html-unsafe="match.label | typeaheadHighlight:query"></span>
     </a>
  </script>

           <div class="alignhManage">
             <input type="text" ng-change="SetupAutoCom(selectedBusiness)" 
             ng-model="selectedBusiness" placeholder="Search Business" 
             typeahead="c as c.companyName for c in Business | filter:$viewValue | limitTo:10" typeahead-min-length='2'                
             typeahead-on-select='onSelectPart($item, $model, $label)' 
             typeahead-template-url="customTemplate.html"">                  
           </div>                                  
</div>



    [{
     "masterId": "1541",
     "companyName": "HENTIQ ",
     "address": { "addressNo": "146" }
    }]
2
  • 1
    You can have the logic inside function onSelectPart by accessing $item's attributes. Commented Jan 22, 2015 at 8:25
  • 1
    Glad to know that, adding it in answer :) Commented Jan 22, 2015 at 9:00

1 Answer 1

1

When you select the suggested item, typeahead-on-select is invoked. You can have the logic inside function onSelectPart by accessing $item's attributes.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.