Setting tagName on application template in ember js

假装没事ソ 提交于 2019-12-21 22:43:43

问题


Views are deprecated in ember js. I want to set the tagName for the application template to "empty" because I don't want my content wrapped in a div - it messes up my css. Previously I have don this by creating an views/application.js and setting tagName: '' but views are deprecated - how can I do this without views?


回答1:


While I agree with the comments that this may not be something you want to do, you can use the ember-legacy-views addon until routable components are released.

Tagless components are also mentioned in the Component Unification RFC, which you might find interesting.




回答2:


[Reposting from this StackOverflow question]

You can control the top-level tag (even not rendering it), and its CSS classes by modifying your Ember Application as follows:

// app/app.js

App = Ember.Application.extend({
  ApplicationView: Ember.Component.extend({
    classNames: ['my-custom-classname'],
    // Or to omit the tag entirely:
    tagName: '',
  }),
  // ...
});

As seen in this discussion.

This does not require any hacks or a legacy plugin.



来源:https://stackoverflow.com/questions/32155466/setting-tagname-on-application-template-in-ember-js

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