angularjs - Showing an empty as first option in select tag -


my app showing empty select field first entry. have read other solution given , tried still not working.

my controller code is:

.controller('usercreatecontroller', function(user,profile,auth) {       alert("hello");       var vm = this;       vm.type = 'create';      profile.all() //this service fetch profiles shown in select field      .success(function(data){       vm.profile = data;  }); vm.userdata.profile = vm.profile[0]; //here have set default value select field 

and html page is:

<label class="col-sm-2 control-label">profile</label> <div class="col-sm-8">   <select ng-model="user.userdata.profile" ng-options="person._id  person.profilename person in user.profile">   </select> </div> 

hierarchy of vm.profile

{   "_id": 46,   "profile": objectid("5516498e95b84548156db754"),   "isactive": true,   "password": "$2a$10$h8wtqsbnzta5equcpullyocsjt0ydcbulevdcntkg/muehpawx/xo",   "username": "admin",   "name": "admin",   "reciptbook": [],   "__v": 0 }, {   "_id": 48,   "profile": objectid("55168b8fbf769e6407ae3603"),   "isactive": false,   "password": "$2a$10$dne84kyl9li8te3fxet5su2ysjzrwndxeriwoui3idaki6eb53qn.",   "username": "hello",   "name": "hello",   "reciptbook": [],   "__v": 0 } 

try add empty option, have undefined value.

<select ng-model="user.userdata.profile" ng-options="person._id  person.profilename person in user.profile">   <option value=""></option> </select> 

Comments

  1. Casino Trio - Online Roulette - CasinoTopTobago.org
    Casino Trio - Online 넷마블 토토 사이트 Roulette - CasinoTopTobago.org The most 안전 사이트 reliable 바퀴벌레 포커 website 외국 라이브 for online roulette. This site has 2.3M monthly 원피스 바카라 visitors.

    ReplyDelete

Post a Comment

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

php - Cloud9 cloud IDE and CakePHP -