2
저는 AngularJS를 처음 접했고 현재 문제가 있습니다.AngularJS의 문제점
나는
는<table-helper datasource="programsList" columnmap="{{programListColumns}}"></table-helper>
내 지시어는 아주이다 ... 내가 지금처럼 HTML 내 요소에 대한 columnmap로 사용하고자하는 내 컨트롤러
//Define the programs list table columns
$scope.programListColumns = "[{ Name: 'Name'},{ Status: 'Status'},{ CreatedByUserName: 'Created By'},{ ModifiedDate: 'Modified'},{ ModifiedByUserName: 'Modified By'}]";
을에 다음이 광범위한,하지만 난 기본적으로 내 데이터 원본에서 테이블을 구축하고 내 칼럼 맵을 사용하여 원하는 데이터를 매핑, 그 말이 맞는 경우 각 항목에 대한 헤더와 행을 만듭니다.
여기 내 columnmap 빈 문자열을 얻을 위를하는 ...
(function(){
var app = angular.module("MdfAngularApp");
var tableHelper = function() {
//Initiate variables for directive
//var template = '<div class="tableHelper"></div>',
var link = function(scope, element, attrs) {
var headerCols = [],
tableStart = '<table>',
tableEnd = '</table>',
table = '',
visibleProps = [],
sortCol = null,
sortDir = 1;
//Watch the datasource for changes.
scope.$watchCollection('datasource', render);
... Functions go here ...
return {
restrict: 'E',
replace: true,
scope: {
columnmap: '@',
datasource: '='
},
link: link,
}
};
app.directive('tableHelper', tableHelper);
}());
내 지시어는 조금 생략합니다. 나는이
<table-helper datasource="programsList" columnmap="[{ Name: 'Name'},{ Status: 'Status'},{ CreatedByUserName: 'Created By'},{ ModifiedDate: 'Modified'},{ ModifiedByUserName: 'Modified By'}]"></table-helper>
처럼 내 HTML을 넣어 재산 columnmap에 "="를 내 분리 범위를 변경하는 경우
지금, 모두 괜찮습니다. 나는 이것보다 조금 더 캡슐화하려고 노력하고있다.
도움을 주시면 감사하겠습니다.