Hi All,
I am trying to loop through some data that I have and create a drop down
that looks like so...
BillyDaKid (Joe Cool) - Cutsop Shop
that is <username> (<first_name last_name) - <shop_name>
I am using a directive. Here is the directive
'use strict';
angular.module('ngProvider', []).directive('providerList', ['$http',
function($http) {
return {
restrict: 'A',
replace: true,
template: '<select class="span4" name="barber-options"
id="barber-options" ng-model="registerData.barber_options" ' +
'ng-options="provider.username + provider.first_name for
provider in providerData">' +
'<option value="" selected>Please choose a
Barber</option></select>',
link: function(scope, element, attrs) {
$http.get('../MINT/scripts/php/get_providers.php')
.success(function(data) {
console.log(data);
scope.providerData = data.slice();
});
}
};
}]);
and here is the HTML
<div class="control-group">
<!-- This directive will be replaced by a provider drop down -->
<span provider-list></span>
</div>
and the data looks like...
{
first_name
: "Joe",
institution_name
: "Cutsop Shop",
last_name
: "Cool",
username
: "BillyDaKid"
}
for ng-options if I try to do the following...
ng-options="provider.username + ' ' + provider.first_name for provider in
providerData">
I get an error. I am not sure why. I know you can use expressions like this
but for my code it is not working. I need a fresh eye. I have been staring
at this code too long
--
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.