-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
Description
Let's consider the following plunk:
http://plnkr.co/edit/pPQWTgkzTLyBdBIX8vfQ?p=preview
MyItemCtrl.js
var klass = require("hsp/klass");
var MyItemCtrl= klass({
attributes: {
"foo" : { type : "string"},
"bar" : { type : "string" }
}
});
module.exports = MyItemCtrl;
hello.hsp
var MyItemCtrl = require("./MyItemCtrl");
{template Hello}
<#myItem foo="FOO" bar="BAR" />
{/template}
{template myItem using ctrl:MyItemCtrl}
foo = {ctrl.foo} <br>
bar = {ctrl.bar} <br>
{/template}
module.exports = Hello;
So far so good, I define attributes in the controller (foo and bar) and pass them from Hello template to <#myItem> and everything works properly.
Now, let's change line 4 in hello.hsp from:
<#myItem foo="FOO" bar="BAR" />
to
<#myItem foo="FOO" bar="BAR" xxx="xxx" />
i.e. let's pass some redundant attrib that is not defined in attributes of the controller.
What we get is a compilation failure plus a cryptic error message:
TypeError: this.ctlAttributes[nm] is undefined
if (this.ctlAttributes[nm].type !== "template") {
I think the code should still compile fine, only raising a warning, with a better description of the issue.