EmberJS Latest Freshers Interview Questions Answers

Explain What Is Model In Ember.js?

Within an Ember application a model object is used to store persistent state.  These model object back the templates and provide data to be displayed within the HTML.

Explain How Ember Applications Are Structured?

The application ember.js is based on MVC  (Model, View, Controller) structure

Models: It defines the data that is used in an application

Controllers: It modifies query and edit the data and provide user interactions

Views: It display the data and capture user actions.
What Controller Does In Ember.js?

Controller does two thing in Ember.js

First it can decorate the model returned by the route
It can listen to actions performed by users

Explain What Is Ember-data ?

Ember-Data is a library that retrieve records from a server, store them, update them in the browser and save them back to the server.

Explain The Role Of Adapter And Types Of Adapters ?

Adapter queries the back end, each adapter is made up of particular back end.  For example Rest adapter deals with JSON APIs and LSAdapter deals with local storage.

Explain What Are The Two Ways Of Defining And Inserting A View?

First way:

By extending the Em.View class, you have to create an oject in your JavaScript to define a view. You can declare your functions and variables inside that.

Now to insert a view in your template,  you have to follow the write the handlebar script {{ #view App.ViewName}}

Second Way:

In this technique, the name of the view object is not required,while inserting into the template. But inside the object you have another property called as templateName which should be initialized with the value same as data template name attribute in handlebar’s script tag, in your template.

Explain What Is Controller In Ember.js ?

When you have to handle a business logic you can use controller, a controller can represent a section of a page or entire part of it.  It is like a block of logical functionality.

Mention The Template Components Used In Ember.js ?

The template components used in ember.js are:

Partial
View
Render
Yield
Outlet

Explain What Ember.js Is And How It Works?

Ember.js is used for creating web applications that eliminates boilerplate and at the same time provides a standard application architecture.

Ember helps to create applications, whose logic runs in browser and also it does not require server requests to functions. Ember update the DOM directly and instantly when any user interacts with things like button and text boxes on the browser page.

List Out Main Components Of Ember.js?

The main components of Ember.js are:

Models
The Router
Controllers
Views
Components
Templates
Helpers

Explain What Is Ember.arraycontroller And What Is The Advantage Of It ?

Ember.ArrayController is a controller that wraps an underlying array and adds additional functionality for the view layer. The advantage is that you have to set up your view binding only once.

Explain Application Template ?

In Ember.js, Application Template is a default template that is used when your application starts.  In template application, you have to put your header, footer and any other decorative item that you want to display on web page.

Explain What Is Ember.mixin Class ?

Ember.mixin class can create objects, whose functions and properties can be shared among other instances and classes.  This will help to share behaviour between objects as well as design objects.

What Is Ember.namespace.class ?

A Namespace.Class is usually used to define an object which contains other objects or methods such as an application or framework.

When Ember.trackedarray Can Be Useful ?

To track Array operations sn Ember.TrackedArray can be used.  It can be more useful in a condition when you want to compute the indexes of items in an array after they have been shifted by subsequent operations.

Explain What Is Serializer?

For turning a raw JSON ( JavaScript Object Notation ) payload returned from your server into a record object a serializer is responsible.  JSON APIs may represent attributes and relationship in many different ways.

How You Can Define A New Ember Class?

You can use call the extend () method on Ember.object to define a new ember class.

Explain How You Can Create An Ember. Handlebars Template ?

Call Ember.Handlebars.Compile() to create an ember.handlebars template.  It will return a function which can be used by ember.view for rendering.

Explain How You Can Add Data Using Fixture Into An Application?

In order to put sample data into an application before connecting the application to long term persistence, fixtures are used.

First update js/application.js to indicate that your application’s application adapter is an extension of the DS.FixtureAdapter.  Adapters are used for communicating with a source of data for your application.  Usually, this will be a web service API.

Next, update the file at js/models/todo.js

Mention Some Of The Functions Used In Ember Packages/ember Run-time/lib And Packages/ember Metal/lib/utils.js ?

None : Returns tur if argument is null or undefined

Empty: Utility function constrains the rules on ember.none by returning false for empty string and empty arrays

isArray: Use this to check whether the value is an array

MakeArray: This function is used when you want a given object in an array

Typeof: This is used to get the type of the passed argument

Compare: Used to compare two objects of possibly different types

isEqual: It checks whether the passed two arguments are logically equal

inspect: While debugging this function is useful. For a given object it returns the string description

Log_Binding:  Log binding is not a function but a Boolean function. If set true ember will log all the activity that is happening on the bindings.

Explain What Is Enumerables In Ember.js ?

In Ember.js an enumerable is any object that contains a number of child objects, and enables you to work with those children using the Ember.Enumerable API. Native JavaScript array is the most common enumerable in majority of Apps.

Explain How You Can Create Instances In Ember.js ?

You can create a new instances once you have defined the class by calling its create() method.  Any properties or methods you defined on the class will be available to instances.

Explain What Is The Use Ember.sortablemixin ?

For array proxies Ember.SortableMixin provides a standard interface to specify a sort order and maintain this sorting when objects are updated, removed or added without changing the order of the underlying model array.

Explain How Is Ember.js Is Different Than Traditional Web Application?

In Ember.js, instead of majority of your application’s logic living on the server, an ember.js application downloads everything it required to run in the initial page load.

So user does not have to load a new page while using the app and UI will responds quickly. The advantage of this architecture is that your web application uses the same REST API as your native App.

Explain How Router And {{outlet}} Tag Can Be Useful In Ember.js?

Router allows you to specify all the possible states of an app and map them to urls
To build a hierarchy of sections by providing a mean for a container template to include a child template the {{outlet}} tag is used.

Explain What Is The Difference Between Router And Route In Ember.js ?

Router:  It is the connecting point between browser’s address bar and our application.  It translates address into Route.

Route: It is where a user request will land after it was translated by a Router.  Route decides what data should be provided to the Template.

Post a Comment

Previous Post Next Post