-1
在模式對話框中,我顯示了來自對象(例如:skill1,skill2,skill3)的單獨跨度中的值。一切運作良好。但是,我收到錯誤消息TypeError: Can not read property' split 'of undefined in App.js
。無法讀取模態中未定義的屬性「拆分」
HTML
<div class="matchSkills">
<span class="tags t-vg ion-trophy icon-tag matchTagVg"
ng-repeat="skillsVeryGood in (skillsVeryGood | commaSplit)">
{{ skillsVeryGood }}
</span>
<span class="tags t-g ion-ribbon-a icon-tag matchTagG"
ng-repeat="skillsGood in (skillsGood | commaSplit)">
{{ skillsGood }}
</span>
</div>
app.js
// comma separating filter
.filter('commaSplit', function() {
return function(input) {
//console.log(input);
var ar = input.split(','); // this will make string an array
return ar;
};
})
controller.js
$ionicModal.fromTemplateUrl('templates/infoPerson.html', function(modalPersonInfo) {
$scope.modalPersonInfo = modalPersonInfo;
}, {
scope: $scope,
});
// Open the modal Person Info
$scope.PersonInfo = function(chat) {
$scope.skillsGood = chat.skillsGood;
$scope.skillsVeryGood = chat.skillsVeryGood;
$scope.modalPersonInfo.show(chat);
};
更改代碼這樣如果{VAR AR = input.split( '');} – Vivz
謝謝Vivz,它的工作原理(輸入=未定義!)! – mm1975
很高興能有幫助:) – Vivz