is it ok to use jquery inside ember controller or component - ember.js

I wanted to follow ember js rules thoroughly.but I am novice to ember js so I am struggle to find ember standard way of doing coding.
Is it ok to do some jquery code inside ember component or controller ?
is it not good to use jquery inside there ?I think it not good to use jquery there.

You should try to minimise the usage of the jQuery in your Ember application unless that is a 3-rd party addon/library.
The reason to do so is that if you introduce jQuery to the application. You have to manually manage your application's state (sync all the state between different components for example).
Doing so you lost the biggest advantage of using a Front-end framework like Ember.JS.
My advice is to try to use computed property to change your application's behavior.

Related

Difference between ember and glimmer

I want to know the differences in ember and glimmer.
I know that glimmer is used for components. But why do we need separate part for component called glimmer?
can anyone explain this in detail?
Thanks in advance
Glimmer.js is lightweight library for creating component-based applications while Ember.js is feature-packed framework. You can think of Glimmer.js as View layer of Ember.
In the future you should be able to grab Glimmer.js, and then install your way with dependencies up to Ember.js. For example - you can install Routing from Ember, etc.
Also, Glimmer.js uses TypeScript by default, and its Components are true ES classes. That's why you get better support in editors for writing apps in Glimmer.js.
Similarity between Glimmer.js and Ember.js is that both use Ember CLI for tooling.

Ember.js consuming REST Services

I have been working on a web app using .NET web forms. Now I'm trying to move to a Web API and a client side application. I'm trying to use Ember.js right now. I'm starting to get confused with Ember 2.0, Ember-Data and stuff.
My problem right now is that I'm trying to consume some of the REST services in order to show a list of things in my Ember app. Is it mandatory for me to use Ember-Data? If not, how can I consume the services to create, read, update and delete items (I mean, am I able to use only ajax or something)?
The Web API was built in order to be usable for many technologies. I need to build an specific URL for each request (even a simple GET has some mandatory parameters). That's why ember-data is not working well for me, at least not what I have learnt about it. Because this.store.find won't allow me to build the URL I need.
Greetings.
Is it mandatory for me to use Ember-Data?
No, it's not. You can use other libraries such as Ember RESTless, or write your own.
You can even use simple jQuery AJAX calls whenever you need to fire a request to your API, however, you'll loose many benefits of Ember Data, such as lazy, asynchronous loading of models when they are needed.
That's why ember-data is not working well for me, at least not what I
have learnt about it. Because this.store.find won't allow me to build
the URL I need.
You can override buildURL method of adapter you're using(for example RESTAdapter), source code on GitHub could be helpful if you would like to do that, and you can find everything you need to create your own behavior for buildURL method in Ember API documentation.

What parts of Ember is needed when only implenting an isolated functionality?

I'm looking to replicate the exact functionality seen here: http://verbalink.com/services/transcription-services#transcription_rates
There's no change of URLs and no requests to the server.
What parts of the Ember framework would be needed to accomplish the above?
Ember, Handlebars, and JQuery (Ember has a dependency on it).

Is Ember really a single page app?

I have been studying Ember.js for about a week now and all examples I studied were single page apps. I have been told to work on a project which expands more than 30 pages and I have no idea what the directory structure would be and if Ember is the best tool as I have never seen an application that links to other pages in the project?
Yes, ember is a single page application, since you only go to one page, it loads the app then you don't need to fetch anymore pages from the server the ember app handles everything. For bigger apps like the one you're suggesting, you'd put each object type (models, controllers, routes, templates, views, etc...) into their own directory for organization.
I quite like to use Ember JS for SPA due to it's flexibility but when it comes to browser support, then I've no choice but to go for Knockout JS for implementing a SPA!
They are both great for SPA, Ember has lot more to offer, but for those that must still support IE7 then the best choice would be Knockout JS...
Hope it helps :)

Multiple ember js apps?

I'm currently adding ember.js to an existing rails app. Is it common to serve different ember apps based on route if the functionality is substantially different? Or is it better to keep it as one ember app?
The way that Ember intends you to use it is that you have one Ember application, and all the back-end stuff such as database interactions are handled by Ruby. Ember just communicates with the back-end to get what it needs.
However, if you feel comfortable having separate Ember applications on different pages, then that's absolutely fine, but it's not how Ember would like you to use it, since it's an ambitious framework.