Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add classNames to the first element of the page without using a view?

Tags:

ember.js

I want to add a wrapper class to the first div element in my page. I used to do this with a view. So, it seems that Ember 2.0 won't support Views anymore. So how can I do that now?

view/application.js:

import Ember from 'ember';

export default Ember.View.extend({
    classNames: ['wrapper'],
});

Resulting in the following page:

<body class="ember-application">

<div id="ember573" class="ember-view wrapper">
    the rest of my page in this div
</div>

</body>

How is this done now that views are deprecated?

like image 782
Renato Carvalho Avatar asked Sep 01 '15 21:09

Renato Carvalho


People also ask

How do I add a class to an element in HTML?

To add a class to an element rather than replacing its existing classes, use the += operator instead. Note, it is important to prefix the new classname with space; otherwise, one of the existing classes of an element is lost.

How do you assign a class to an element?

To add a class to an element, without removing/affecting existing values, append a space and the new classname, like so: document. getElementById("MyElement").


1 Answers

I used css to solve this problem:

body > .ember-view {
  padding-left: 240px; //styles for container goes here
}
like image 66
Gennady Dogaev Avatar answered Oct 01 '22 16:10

Gennady Dogaev