camelcase 바인딩을 사용하여 angularjs 구성 요소를 라우팅하면 작동하지 않습니다. 그 이유는 모르겠습니다.AngularJs 1.6 구성 요소 BIndings
여기에 내가 어떤 방식으로 결합 PARAM의 dataFileId을 채울 수 아니에요 예
구성 요소
angular.
module('pdaFile').
component('pdaFile', {
templateUrl: 'app/myComponent/myComponent.html',
bindings:{
data:"<",
dataFileId:"@",
datafileid:"@",
id:"@"
},
controller: ['NgTableParams','UserAuthService',
function pdaFileController(NgTableParams,UserAuthService) {
var self=this;
...
self.$onInit = function() {
console.log(self.dataFileId); // undefined
console.log(self.id); // OK
console.log(self.datafileid); //OK
};
appConfig.js
..
// 라우터
angular.
module('app')
.config(['$locationProvider', '$routeProvider',
function config($locationProvider, $routeProvider) {
$locationProvider.hashPrefix('!');
$routeProvider.
when('/pda', {
template: '<pda-file id="pippo" datafileid="current" data-file-id="current"></pda-file>'})
.
..
입니다. 그것은 항상 정의되지 않습니다. 시도해 보았습니다.
<pda-file data-file-id="current"></pda-file>'
<pda-file dataFileId="current"></pda-file>'
및 다른 방법으로 시도했습니다. 대신 non camelcase param datafileid와 id는 완벽하게 작동합니다.
누군가 내게 그 이유를 말할 수 있습니까?
나는 당신이 옳은 것 – Ferie
접두사 이름을 속성으로'data' 또는'data' 같은 단어를 사용하지 않는 것이 좋습니다 것입니다. dataFileId에서 dtFileId로 변경하면 dt-file-id를 속성으로 사용합니다. – Massimo