Closed bondib closed 7 years ago
This fails:
<button click.delegate="someMethod(ddDashboardListButtonRef.attributes['aria-expanded'].value)"
ref="ddDashboardListButtonRef" type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown">
with:
cannot find 'ddDashboardListButtonRef' in type 'TYPE_NAME' ....
Not sure related but this started when I upgraded to node 6
you might fix this temporarily by moving ref="ddDashboardListButtonRef"
to be the first attribute after <button
.
I cannot duplicate the error; however, if you use ddDashboardListButtonRef
anywhere else (not a child of the button) then 0.9.12 will fail. Also if you use ddDashboardListButtonRef
before the button declaration, then it won't be found either.
try 0.9.13.
if that still causes issues for you then you'll have to make failing test for me to reproduce.
spec/failing.spec.ts
(this test currently passes for me (I'm on Node 6.7.0)) //#124
it("ref variable not found", (done) => {
let viewmodel = `
export class Foo{
someMethod(value){}
}`;
let view = `
<template>
<button click.delegate="someMethod(ddDashboardListButtonRef.attributes['aria-expanded'].value)"
ref="ddDashboardListButtonRef"
type="button"
class="btn btn-sm btn-default dropdown-toggle"
data-toggle="dropdown">
</template>`;
let reflection = new Reflection();
let rule = new BindingRule(reflection);
let linter = new Linter([rule]);
reflection.add("./foo.ts", viewmodel);
linter.lint(view, "./foo.html")
.then((issues) => {
try {
expect(issues.length).toBe(0);
}
catch (err) { fail(err); }
finally { done(); }
});
});
gulp format
I'm on node 6.7.0 as well. Well, if I move the ref to be the first attribute - it passes. So the issue occurs if the ref part is after the use of it.
sorting the attributes so that ref is resolved first, should have been done since 0.9.9 and it does appear to work if I add this to the specs.
I've been having issues with npm and its cache too; so you may have to clear everything: User/{yourname}/AppData/Roaming/npm-cache
then reinstall (after rimraf node_modules).
can you be more specific please, with succinct example? The spec for #119 is passing. i.e.
So I suspect there is a different use case.