I'm wrapping a JS component into an Ember Addon, something I've done many times before, and yet I'm running into a problem right at the get-go that makes me worry that maybe the "magic" of ember has shifted slightly? Anyway hoping can explain why the following:
import Ember from 'ember';
import layout from '../templates/components/nav-menu';
export default Ember.Component.extend({
layout: layout,
tagName: 'nav',
classNames: ['navmenu','navmenu-default','navmenu-fixed-left'],
attributeNames: ['role:navigation'],
classNameBindings: ['offcanvas'],
hideAt: null,
offcanvas: function() {
let hideAt = this.get('hideAt');
if(!hideAt) {
return 'offcanvas';
} else {
return 'offcanvas-%@'.fmt(hideAt);
}
}.property('hideAt'),
_initialize: function() {
this.$().offcanvas();
}.on('didInsertElement')
});
This fails on two counts. As-is it fails in the offcanvas
computed property saying:
Uncaught TypeError: undefined is not a function
Very odd but it gets odder. If remove this computed property it then fails at the _initialize()
call with the same "undefined is not a function" error:
I'm using Ember 1.11.0, Ember-CLI 0.2.2.
Aucun commentaire:
Enregistrer un commentaire