I'm trying to create a dropdown list from an angular controller: My html code:
<select>
<option value="" disabled selected >Choose your option</option>
<option ng-repeat="ty in type">{{ty.$value}}</option>
</select>
Controller code:
var typeRef = new Firebase(FIREBASE_URL + "/type");
var typeArray = $firebase(typeRef).$asArray();
typeArray.$loaded().then( function (data) {
$scope.type = data;
console.log(data);
});
In this case it works:
<ul id='dropdown2' class='dropdown-content'>
<li ng-repeat="ty in type"><a href="#!">{{ty.$value}}</a></li>
</ul>
The ty.$value works in above code, but in this <select> tag doesn't show anything any idea why is that?
optiontags insideoption! so useng-repeatin theselecttag!$loaded():$scope.type = $firebase(typeRef).$asArray(). And please don't useconsole.logto debug the AngularFire loading sequence. Just put<pre>{{ type | json }}</pre>in your HTML. The docs are great too: firebase.com/docs/web/libraries/angular/guide/… (especially if you upgrade to the latest version).