HAML理解“data”关键字的基本哈希,因此:
%div {data:{id:“5”,名称:“carsten”}}
相当于
%div {‘data-id’=> “5”,“data-name”=> “carsten”}
恕我直言,以前的语法更具可读性.
AngularJS使用了很多ng-something属性.是否可以配置HAML,以便:
%html {‘ng-app’=> “myApp”,“ng-controller”=> “myCtrl”}
可写成
%html {ng:{app:“myApp”,controller:“myCtrl”}}
解决方法
您不需要配置任何内容,这是当前版本的工作方式:
%html{ ng: { app: "myApp",controller: "myCtrl" } }
生产:
<html ng-app='myApp' ng-controller='myCtrl'></html>
文档需要更新,但current behaviour是具有值的任何属性,哈希以这种方式扩展,而不仅仅是数据.