Hi

I have an textbox which user can search. And when user starts typing i show 
suggestions using typehead.
When user selects a suggestion i want to get the id of the selected object 
and show the name of the object in the textbox. 
It works perfectly on angularjs(1.0.5) with ui-bootstrap-tpls(0.4.0).  ---> 
it shows the name of the object in the textbox and sets the id of the 
object to the model.
But my project uses angularjs (v1.2.22) with ui-bootstrap-tpls.js(0.11.0).  
---> it shows the id of the object in the textbox. But it must show the 
name of the object.

How can i solve the issue please help.

Working one
<!DOCTYPE html>
<html  ng-app="firstChar">

  <head>
    
    <script src=
"http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js";></script>
    <script src=
"http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.4.0.js";></script>
    <link href=
"//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css"
 
rel="stylesheet">
     <script>

        angular.module('firstChar', ['ui.bootstrap']);

        function TypeaheadCtrl($scope) {
            $scope.selected = undefined;
            $scope.states = [{'id':'1', 'name':'Alabama'}, {'id':'2','name':
'Alaska'}];
        }

    </script>
    
  </head>

  <body>
    <div class="container-fluid" ng-controller="TypeaheadCtrl">
        Selected: <span>{{selected}}</span>
        <input type="text" ng-model="selected" typeahead="state.id as 
state.name for state in states | filter:selected">
    </div>
  </body>

</html>

Kodu buraya girin...

Not working one
<!DOCTYPE html>
<html  ng-app="firstChar">

  <head>
    
    <script src=
"http://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.js";></script>
    <script src=
"http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.11.0.js";
></script>
    <link href=
"//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css"
 
rel="stylesheet">
     <script>

        angular.module('firstChar', ['ui.bootstrap']);

        function TypeaheadCtrl($scope) {
            $scope.selected = undefined;
            $scope.states = [{'id':'1', 'name':'Alabama'}, {'id':'2','name':
'Alaska'}];
        }

    </script>
    
  </head>

  <body>
    <div class="container-fluid" ng-controller="TypeaheadCtrl">
        Selected: <span>{{selected}}</span>
        <input type="text" ng-model="selected" typeahead="state.id as 
state.name for state in states | filter:selected">
    </div>
  </body>

</html>
Kodu buraya girin...


-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to