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>'
と他の方法です。代わりに非camelcaseのparam datafileidとidは完全に機能します。
誰かが私にその理由を教えてもらえますか?
私はあなたが正しい – Ferie
名接頭辞を属性として 'data'または' data'のような言葉を使用しないようお勧めします。 dataFileIdからdtFileIdに変更すると、dt-file-idを属性として使用します。 – Massimo