Skip to content

Instantly share code, notes, and snippets.

View juarezpaf's full-sized avatar

Juarez Filho juarezpaf

View GitHub Profile

WARNING

This gist is outdated! For the most up-to-date information, please see http://emberjs.com/guides/routing/!

It All Starts With Templates

An Ember application starts with its main template. Put your header, footer, and any other decorative content in application.handlebars.

<header>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Ember.js Router Example</title>
<meta name="description" content="Example of a basic Ember.js application with a Router" />
<meta name="author" content="http://codebrief.com" />
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
App.PostRoute = Em.Route.extend({
model: function(params) {
return Em.$.ajax({
type: 'GET',
url: App.API+'/post/'+ params.post_id,
dataType: 'json',
contentType: 'application/json',
context: this
}).then(function(json) {
if (json.status.code === 200) {//API return status code with success or errors