I need to do something like this : When you select ex. "login", then in input text shows login from $scope.logins . The same with password
JS:
$scope.logins = [{
"login" : "log",
"password" : "pass"
}]
$scope.onSelectBoxChange = function(selectedValue){
if(selectedValue=="login"){
$scope.value = $scope.logins[0].login;
}else{
$scope.value=undefined;
}
}
HTML :
<ul>
<li><button ng-model="type" ng-change="onSelectBoxChange(type)">login</button>
</li>
<li><button ng-model="type" ng-change="onSelectBoxChange(type)">password</button>
</li>
</ul>
<input class="form-control" name="type" placeholder="value" ng-model="value" style="margin-bottom:5px;">
My code doesn't work. Thanks for answers in advance!