Prevent Jade from being assigned to a destination in an HTML element

I want to define a local variable in the input tag for an Angular 2 application:

input(#sometext) button((click)="addTechnology(sometext.value)") Add 

The result that I expect is as follows:

 <input #sometext/> <button (click)="addTechnology(sometext.value)">Add</button> 

However, the actual output (note the extra ="#sometext" ):

 <input #sometext="#sometext"/> <button (click)="addTechnology(sometext.value)">Add</button> 

Thus, Angular 2 throws the following error, very likely because of this ="#sometext" :

 Cannot find directive with exportAs = '#sometext' Error: Cannot find directive with exportAs = '#sometext' at new BaseException (https://code.angularjs.org/2.0.0-alpha.28/angular2.dev.js:7248:25) at _findDirectiveIndexByExportAs (https://code.angularjs.org/2.0.0-alpha.28/angular2.dev.js:12454:13) at https://code.angularjs.org/2.0.0-alpha.28/angular2.dev.js:12435:22 at Map.forEach (native) at Function.execute.MapWrapper.forEach (https://code.angularjs.org/2.0.0-alpha.28/angular2.dev.js:7614:15) at createDirectiveVariableBindings (https://code.angularjs.org/2.0.0-alpha.28/angular2.dev.js:12434:16) at _createProtoElementInjector (https://code.angularjs.org/2.0.0-alpha.28/angular2.dev.js:12414:39) at _createElementBinders (https://code.angularjs.org/2.0.0-alpha.28/angular2.dev.js:12391:34) at _createAppProtoView (https://code.angularjs.org/2.0.0-alpha.28/angular2.dev.js:12331:5) at https://code.angularjs.org/2.0.0-alpha.28/angular2.dev.js:12641:32 

Do you know any way to prevent Jade from completing the attribute with optional ="#sometext" ?

+7
javascript angular pug
source share
1 answer

In the end, it was as simple as using doctype html at the beginning of the Jade template. I used it in the main layout, but it seems that the included files also need it.

+8
source share

All Articles