我试图在Angular中使用
http://angular-ui.github.io/bootstrap/实现一个预型
似乎很容易,但我得到以下错误:
Global symbol
$viewValue
requires explicit package name.
什么是$ viewValue?它似乎没有被定义。
谢谢
@H_502_13@@H_502_13@
这里是一个工作typeahead示例:
<div class="container"> <div ng-controller="mainCtrl" class="row-fluid"> <form class="row-fluid"> <div class="container-fluid"> <input type="text" ng-model="selected" typeahead="state for state in states | filter:$viewValue" /> </div> </form> </div> </div> <script> angular.module('myApp',['ui.bootstrap']) .controller("mainCtrl",function ($scope) { $scope.selected = ''; $scope.states = ['Alabama','Alaska','Arizona','Arkansas','California','Colorado','Connecticut','Delaware','Florida','Georgia','Hawaii','Idaho','Illinois','Indiana','Iowa','Kansas','Kentucky','Louisiana','Maine','Maryland','Massachusetts','Michigan','Minnesota','Mississippi','Missouri','Montana','Nebraska','Nevada','New Hampshire','New Jersey','New Mexico','New York','North Dakota','North Carolina','Ohio','Oklahoma','Oregon','Pennsylvania','Rhode Island','South Carolina','South Dakota','Tennessee','Texas','Utah','Vermont','Virginia','Washington','West Virginia','Wisconsin','Wyoming']; }); </script>
http://jsfiddle.net/alfrescian/ZjPWe/
$ viewValue是视图中的当前值 – 您的字符串输入。 $ viewValue在ngModel
中指定。