In Ember, the application's state manager handles routing. Let's take a look at a simple example:
App.stateManager = Ember.StateManager.create({
start: Ember.State.extend({
index: Ember.State.extend({
route "/",| { | |
| "Results": [ | |
| { | |
| "Id": 550518851, | |
| "Name": "Tri-Band Ballpoint Pen", | |
| "Description": "Tri-band ballpoint pen with silver trim and black rubber grip for writing comfort and control. These tri-band ballpoint pens include plunger action. These tri-band ballpoint pens are also available in a variety of new colors! Tri-band ballpoint pens are a great giveaway for any event or trade show. Ensure your clients remember you and write away the competition with these great ballpoint pens!", | |
| "Number": "AZ898", | |
| "ImageUrl": "media/22117985", | |
| "VirtualSampleImages": [ | |
| { |
| <?xml version="1.0" encoding="utf-8"?> | |
| <?qbxml version="13.0"?> | |
| <QBXML> | |
| <QBXMLMsgsRq onError="stopOnError"> | |
| <SalesReceiptAddRq> | |
| <SalesReceiptAdd defMacro="MACROTYPE"> <!-- required --> | |
| <CustomerRef> <!-- optional --> | |
| <ListID >IDTYPE</ListID> <!-- optional --> | |
| <FullName >STRTYPE</FullName> <!-- optional --> | |
| </CustomerRef> |
| # Git branch in prompt. | |
| parse_git_branch() { | |
| git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
| } | |
| export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ " | |
| source ~/.profile |
| window.ChangeQuantity ||= {} | |
| ChangeQuantity.load = ()-> | |
| $("input.change-quantity").click((evnt)-> | |
| evnt.preventDefault() | |
| quantityField = $(this).parent().find('input.quantity') | |
| currVal = parseInt(quantityField.val()) |
| class Node | |
| attr_accessor :data, :left, :right | |
| def initialize(*args) | |
| @data,@left,@right = args | |
| end | |
| end | |
| class Tree | |
| attr_accessor :root |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> | |
| <CORSRule> | |
| <AllowedOrigin>*</AllowedOrigin> | |
| <AllowedMethod>GET</AllowedMethod> | |
| <MaxAgeSeconds>3000</MaxAgeSeconds> | |
| <AllowedHeader>*</AllowedHeader> | |
| </CORSRule> | |
| </CORSConfiguration> |
| # Monkey Patch ruby because of a bug introduced in ruby versions greater than 1.9.2 | |
| # For some reason the exit code is all wrong in later version of ruby and even though | |
| # the issue was closed as sorted it's still broken in ruby version 1.9.3-p194. | |
| # (see http://redmine.ruby-lang.org/issues/5218 for more information) | |
| # Put this in spec_helper.rb or test_helper.rb so that it only affects specs and the CI server. | |
| if defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby" && RUBY_VERSION >= "1.9" | |
| module Kernel | |
| alias :__at_exit :at_exit | |
| def at_exit(&block) | |
| __at_exit do |