将自定义属性添加到 ejs 模板

Adding custom attributes to ejs template

我在我的nodejs项目中使用了ejs模板引擎,我已经通过下面的代码输出了文本元素

<%- text_field_tag('empId', '', {id: 'empId', Class: 'some_class', type: 'text'}) %>

现在为了利用AngularJs的优势,我想添加ng-model属性,所以我修改了如下代码

<%- text_field_tag('empId', '', {id: 'empId', Class: 'some_class', type: 'text', ng-model: "empId"}) %>

但这以错误结尾——如下

SyntaxError: Unexpected token - in /home/ubuntu/workspace/public/views/add.ejs while compiling ejs

让我知道我该如何实现?

ng-model 需要用单引号

<%- text_field_tag('empId', '', {id: 'empId', Class: 'some_class', type: 'text', 'ng-model': "empId"}) %>

这个有效