use ng-model in <ul> list generated by ng-repeat
Something like this should work for you:
function test($scope)
{
$scope.setSelected = function(prop) {
$scope.selectedprop = prop;
};
$scope.props = [{label: "Aaaaaa"},{label: "Bbbbbb"},{label: "Cccccc"}];
}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<style>li.selected {text-decoration: underline;}</style>
<div ng-app="" ng-controller="test">
<ul>
<li ng-repeat="prop in props" ng-click="setSelected(prop)" ng-class="{selected: prop == selectedprop}" ng-cloak="">{{prop.label}}</li>
</ul>
My Selected Property: {{selectedprop.label}}
</div>
ng-model binds to the prop
, not to it's label
field, so you probably use something like this:
My Selected Property: {{selectedpropName.label}}