0
내가 무엇입니까 오류 메시지는 다음과 같습니다에 의해 발생하는이 구문 오류는 어떻게 해결합니까?
Syntax Error: Token '.' is unexpected, expecting [}] at column 23 of the expression [] starting at [{4}].
문제의 원인이되는 잘못된 HTML. AngularJS와의
<tr ng-repeat="record in key_table">
<td ng-repeat="data in record">
{[{ data }]}
</td>
<td>
<button type="button" class="btn btn-default" ng-click="$ctrl.open({[{ record.KeyNum }]})">Open me!</button>
</td>
<td>
<button>Edit</button> <button>Delete</button>
</td>
</tr>
open 함수 : 또한
angular.module('KeyManager').controller("KeyController", function(httpFactory, $uibModal) {
$ctrl = this;
$ctrl.open = function() {
var modalInstance = $uibModal.open({
animation: true,
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body',
templateUrl: 'RecordViewer.html',
controller: 'RecordViewerInstanceCtrl',
controllerAs: '$ctrl',
size: "lg",
resolve: {
items: function (keyNum) {
httpFactory.getRecord(keyNum).then(
function(response) {
$ctrl.items = response.data[0];
},
function(response) {
console.log(response);
$ctrl.items = [];
}
);
return $ctrl.items;
}
}
});
});
, 나는 이렇게와 시작 및 종료 기호가 변경되었습니다 나뭇 가지 파일에이 일을하고 있습니다 "{[{"와 "} ]} "로 표시됩니다.
추가 정보 : 내가
"$ctrl.open(record.KeyNum)"
에 NG 클릭 지시어를 전환 시도했지만입니다 리터럴 문자열 record.KeyNum 아웃이 만 인쇄는 설명
here 그래서 @smarx 댓글이 대답은 .
여기에 $ ctrl은 무엇입니까? – Sajeetharan
'$ ctrl.open (record.KeyNum)'을 원할까? – smarx
$ ctrl이 이것이며이 함수가있는 컨트롤러입니다. 더 명확하게 업데이트 할 것입니다. 본질적으로 나는 [ui- bootstrap] (https://angular-ui.github.io/bootstrap/#/modal)에 주어진 예제를 따르고있다. – rpiper