how do I write jade-style html with an angular app? [closed]

天涯浪子 提交于 2019-12-13 09:56:15

问题


I started writing an express app and really liked using Jade for my html. Now I'm writing an angular app and don't want to type all of the "<>" for my html. I haven't decided on a backend for the angular app.

How do I write the html for an angular app using jade?

Edit:

I made a package.json and included:

"dependencies": {
"jade":"0.35.x"
}

then ran npm install

But when I create and open index.jade it doesn't render html, por que?


回答1:


In HAML you can use custom attributes like

%button{:"ng-click" => "myFunc()"} Click here

to render

<button ng-click="myFunc()">Click here</button>

OR - use custom data attributes like this

%button{:data {:"ng-click" => "myFunc()"}} Click here

to render

<button data-ng-click="myFunc()">Click here</button>

See http://haml.info/docs/yardoc/file.REFERENCE.html#html5_custom_data_attributes for the official docs on HTML5 Custom Data Attributes.



来源:https://stackoverflow.com/questions/20676198/how-do-i-write-jade-style-html-with-an-angular-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!