Das Routing einer angularjs-Komponente mit Camelcase-Bindung funktioniert bei mir nicht, ich weiß nicht warum.AngularJs 1.6 ComponentBindings
Hier ist das Beispiel
Komponente
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
..
// Router
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>'})
.
..
ich nicht in der Lage bin, die Bindung param dataFileId in irgendeiner Weise zu füllen. Es ist immer undefiniert. Ich versuchte mit
<pda-file data-file-id="current"></pda-file>'
<pda-file dataFileId="current"></pda-file>'
und andere Möglichkeiten. Stattdessen funktionieren die non camelcase param datafileid und id einwandfrei.
Jemand kann mir sagen, warum?
würde ich vorschlagen, nicht Worte wie 'data' oder' data' als Namen Attribute Präfixe – Ferie
Sie haben Recht. Der Wechsel von dataFileId zu dtFileId funktioniert einwandfrei, mit dt-file-id als Attribut – Massimo