我想在this picture上看到一个带AngularJS的输入手机。
我试过了:
如何将图像插入ng-option?我是AngularJS的新手。
<div ng-app="myApp" ng-controller="ExampleController">
<form name="myForm">
<label for="mySelect">Make a choice:</label>
<select name="mySelect" id="mySelect"
ng-options="option.name for option in data.availableOptions track by option.id"
ng-model="data.selectedOption">A</select>
<input type="text" name="number" value="{{data.selectedOption.macode}}">
</form>
这是js文件
var myApp=angular.module('myApp', [])
myApp.controller('ExampleController', ['$scope', function($scope) {
$scope.data = {
availableOptions: [
{id: '1', name: 'VIET NAM', macode:'+84'},
{id: '2', name: 'AMERICAN',macode:'+85'},
{id: '3', name: 'CANADA',macode:'+86'}
],
selectedOption: {id: '3', name: 'Option C',macode:'+86'} //This sets the default value of the select in the ui
};
code:'+84';
}]);