如何将 ng-app 添加到 slim 模板中
How to add ng-app into a slim template
我需要将我的 ng-app=myApp 添加到我的 application.html.slim 中。我遇到的问题是我找不到关于如何执行此操作的博客,而且它不在 slim 文档中。我必须将我的 ng-app 放在这个文件中。怎么插入?
doctype html
head
title PlanoX
= stylesheet_link_tag("application", media: "all")
= javascript_include_tag("application")
= csrf_meta_tags
= favicon_link_tag('favicon_64x64.ico')
= javascript_include_tag "//ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"
= javascript_include_tag "//ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular-resource.min.js"
meta[name="viewport" content="width=device-width, initial-scale=1.0"]
body.default
= render("layouts/header")
= yield
= render("layouts/footer")
我没用过slim,我只是看看他们的docs
Attributes
You write attributes directly after the tag. For normal text attributes you must use double " or single quotes ' (Quoted attributes).
a href="http://slim-lang.com" title='Slim Homepage' Goto the Slim homepage
由于 ng-app 只是一个标签属性,您可以这样做:
body.default ng-app="myApp"
我需要将我的 ng-app=myApp 添加到我的 application.html.slim 中。我遇到的问题是我找不到关于如何执行此操作的博客,而且它不在 slim 文档中。我必须将我的 ng-app 放在这个文件中。怎么插入?
doctype html
head
title PlanoX
= stylesheet_link_tag("application", media: "all")
= javascript_include_tag("application")
= csrf_meta_tags
= favicon_link_tag('favicon_64x64.ico')
= javascript_include_tag "//ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"
= javascript_include_tag "//ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular-resource.min.js"
meta[name="viewport" content="width=device-width, initial-scale=1.0"]
body.default
= render("layouts/header")
= yield
= render("layouts/footer")
我没用过slim,我只是看看他们的docs
Attributes
You write attributes directly after the tag. For normal text attributes you must use double " or single quotes ' (Quoted attributes).
a href="http://slim-lang.com" title='Slim Homepage' Goto the Slim homepage
由于 ng-app 只是一个标签属性,您可以这样做:
body.default ng-app="myApp"