Javascript 角度ui引导类型预选多个
搜索人员时是否可以显示与人员相关的所有资料。而且还必须选择多个人 下面是我的示例代码Javascript 角度ui引导类型预选多个,javascript,angularjs,typeahead,Javascript,Angularjs,Typeahead,搜索人员时是否可以显示与人员相关的所有资料。而且还必须选择多个人 下面是我的示例代码 <!doctype html> <html ng-app="plunker"> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js"></script> <script src="http://angular-u
<!doctype html>
<html ng-app="plunker">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js"></script>
<script src="http://angular-ui.github.com/bootstrap/ui-bootstrap-tpls-0.2.0.js"></script>
<script src="example.js"></script>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
</head>
<body>
<div class='container-fluid' ng-controller="TypeaheadCtrl">
<input type="text" ng-model="selectedStuff" typeahead="stuff as stuff.desc for stuff in stuffs | filter:{name: $viewValue, desc: $viewValue}"/>
<span>{{selectedStuff.name}}</span>
<span>{{selectedStuff.desc}}</span>
</div>
</body>
</html>
angular.module('plunker', ['ui.bootstrap']);
function TypeaheadCtrl($scope) {
$scope.stuffs= [
{
"name":"thing1",
"desc":"this is the first thing",
"title": "this is the first title"
},
{
"name":"thing2",
"desc":"this is the second thing",
"title": "this is the second title"
}
]
}
在这里,当我搜索时,它只显示名称、描述或标题,但我需要显示全部三个属性,而不是一个属性
我需要选择多个like标签
请帮忙解决这个问题
提前感谢我想您需要将html更改为
<input type="text" ng-model="selectedStuff"
typeahead="stuff as stuff.name + ' ' +stuff.desc + ' ' + stuff.title for stuff in stuffs | filter:{name: $viewValue, desc: $viewValue}"/>