Last active
August 26, 2016 08:54
-
-
Save hallojoe/c3ca34135522370b999265e1c250bccb to your computer and use it in GitHub Desktop.
Dropdown prevalues with angular
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
https://plnkr.co/edit/MaCgoj | |
--><!DOCTYPE html> | |
<html ng-app="myApp"> | |
<head> | |
<link data-require="bootstrap-css@3.3.6" data-semver="3.3.6" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css" /> | |
<script data-require="angularjs@1.5.8" data-semver="1.5.8" src="https://opensource.keycdn.com/angularjs/1.5.8/angular.min.js"></script> | |
<script> | |
var myApp = angular.module('myApp',[]); | |
myApp.controller('TestController', ['$scope', function($scope) { | |
$scope.HuslejeOgUdgifter = { | |
AnslaaetElType: { | |
EditorId: 41414, | |
Id: 51, | |
Alias: "anslaaetElType", | |
Value: "Aconto", | |
PreValues: [ | |
{ | |
Value: "Tilmelding", | |
Id: 49, | |
SortOrder: 1 | |
}, | |
{ | |
Value: "Inklusiv", | |
Id: 50, | |
SortOrder: 2 | |
}, | |
{ | |
Value: "Aconto", | |
Id: 51, | |
SortOrder: 3 | |
} | |
] | |
} | |
} | |
}]); | |
</script> | |
</head> | |
<body ng-controller="TestController"> | |
<div class="container"> | |
<div class="page-header"> | |
<h1>Self contained select options</h1> | |
<p>An object holding it's own options...</p> | |
</div> | |
<div class="form-group"> | |
<select class="form-control" | |
ng-options="s.Id as s.Value for s in HuslejeOgUdgifter.AnslaaetElType.PreValues" | |
ng-model="HuslejeOgUdgifter.AnslaaetElType.Id" no-dirty-check=""></select> | |
</div> | |
<pre>{{ HuslejeOgUdgifter.AnslaaetElType | json}}</pre> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment