我現在用的是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