Bilal Blu Bilal Blu - 1 year ago 105
jQuery Question

AngularJs: Select Value From DropDown

I am using AngularJS with JQM I create a drop-down for selecting value and data comies in it using AngularJS Controller. It works fine
But when I add

then strange executions
I select first value it selected second.

My HTML Part

<div ng-controller="MyCtrl">
<select data-native-menu="false" data-role="listview" ng-options="size as for size in sizes " ng-model="item" ng-change="update()"></select>
{{item.code}} {{}}

JS Part

$scope.sizes = [ {code: 1, name: 'n1'}, {code: 2, name: 'n2'}];
$scope.update = function() {
console.log($scope.item.code, $

If I remove
data-native-menu="false" data-role="listview"
then code works fine

Please Help Me

Demo Page of My Example is Here

Answer Source

You can find working code in Fiddle


<div ng-controller = "fessCntrl" > 
 <div query-mobile-tpl>
  <select data-role="listview" data-inset="true" ng-options="size as for size in sizes " ng-model="item" x-ng-change="update(item)"></select>
  <pre> {{item.code | json}} {{ | json}}</pre>


 var fessmodule = angular.module('myModule', []);

fessmodule.controller('fessCntrl', function ($scope) {

    $scope.sizes = [ {code: 1, name: 'n1'}, {code: 2, name: 'n2'}];
    $scope.update = function() {
    console.log($scope.item.code, $

fessmodule.directive('jqueryMobileTpl', function() {
  return {
    link: function(scope, elm, attr) {

fessmodule.directive('repeatDone', function () {
    return function (scope, element, attrs) {
        // When the last element is rendered
        if (scope.$last) { 

fessmodule.$inject = ['$scope'];

Sounds like you use old angular sources or get collisions with other sources.

Hope it will help you

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download