问题
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