>>> [DisplayName("Template Type:")] >>> public TemplateTypes TmplType { get; set; }>>>
>>><div class="col-md-8"> >>> @*@Html.DropDownList("templateTypes", (IEnumerable<SelectListItem>)ViewBag.TemplateTypes, new { @class = "form-control", ng_model = "currentTemplate.tmplType" })*@ >>> <select class="form-control" name="templateTypes" id="templateTypes" >>> ng-model="currentTemplate.tmplType" >>> ng-options="t.value as t.text for t in templateTypes"></select> >>> </div>>>>
>>> public string Text { get; set; } >>> // >>> // Summary: >>> // Gets or sets the value of the selected item. >>> // >>> // Returns: >>> // The value. >>> public string Value { get; set; }>>
<!DOCTYPE html> >><html data-ng-app="MyApp"> >><head> >> <meta name="viewport" content="width=device-width" /> >> <title>Index</title> >></head> >><body data-ng-controller="myCtrl"> >> <div> >> <select name="templateTypes" id="templateTypes" >> data-ng-model="tmplType" >> data-ng-options="t.Value as t.Text for t in templateTypes"> >> </select> >> <input type="text" data-ng-model="tmplType" /> >> </div> >></body> >> >><script src="~/Scripts/angular.js"></script> >><script type="text/javascript"> >> var app = angular.module('MyApp', []).controller('myCtrl', ['$scope', function ($scope) { >> >> $scope.templateTypes = []; >> $scope.templateTypes.push({ Text: "One", Value: "1" }); >> $scope.templateTypes.push({ Text: "Two", Value: "2" }); >> $scope.templateTypes.push({ Text: "Three", Value: "3" }); >> >> $scope.tmplType = ''; >> }]); >></script> >></html>What's different ?