我现在用的是Angularjs引导事先键入的内容指令,并运行到,上面写着以下内容的错误:Angularjs事先键入的内容指令 - 错误:“”无法读取财产“不定长度””
错误
TypeError: Cannot read property 'length' of undefined
at ui-bootstrap-tpls-0.12.1.min.js:9
at angular.min.js:112
at l.$get.l.$eval (angular.min.js:125)
at l.$get.l.$digest (angular.min.js:122)
at l.$get.l.$apply (angular.min.js:126)
下面是我的HTML
<h4>Asynchronous results</h4>
<pre>Model: {{asyncSelected | json}}</pre>
<input type="text" ng-model="asyncSelected" placeholder="Patients loaded via $http" typeahead="result as result.patient.drug.drugindication for result in getPatient($viewValue)" typeahead-loading="loadingPatients" class="form-control">
<i ng-show="loadingPatients" class="glyphicon glyphicon-refresh"></i>
的Javascript
$scope.getPatient = function(val) {
return $http.get('https://api.fda.gov/drug/event.json', {
params: {
search: 'patient.drug.drugindication:' + val
}
}).then(function(response){
return
{
search: response.data
}
});
};
在
getPatient()
收到
Codepen http://codepen.io/anon/pen/XJBNEq?editors=101
你有任何plnkr /小提琴吗? – 2015-03-03 13:55:15
请看我更新的文章 – user1142130 2015-03-03 16:39:57