In this guide we will cover two main cases:
- Ember specific library
- vendor library
The Ember library will assume that Ember has already ben loaded (higher in the loading order) and thus will assume it has access to the Ember API.
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
classNames: ['range-slider'], | |
value: 0, | |
attributeBindings: ['data-slider'], | |
'data-slider': 0, | |
valueDidChange: Em.observer('value', function(){ |
var computed; | |
App.computed = {}; | |
computed = Ember.computed; | |
App.computed.sample = function(dependentKey) { | |
return (computed("" + dependentKey + ".@each", function() { | |
var items, length; | |
items = this.getWithDefault(dependentKey, Em.A([])); |
# /app/controllers/comment.coffee | |
`import promisedProperty from "../utils/promised_property"` | |
CommentController = Ember.ObjectController.extend | |
needs: ["application"] | |
currentUser: Ember.computed.alias('controllers.application.currentUser') | |
isCommentController: true |
# place in [app]/public so it gets compiled into the dist folder | |
Options FollowSymLinks | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.html$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.html [L] |
// accompanies this blogpost http://sketchytech.blogspot.co.uk/2014/11/swift-how-to-draw-clock-face-using.html | |
import UIKit | |
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. |
// service | |
angular | |
.module('app') | |
.service('logger', logger); | |
function logger () { | |
this.logError = function (msg) { | |
/* */ | |
}; | |
} |
/* A éviter */ | |
function Customer () { | |
this.name = {}; | |
this.sendMessage = function () { }; | |
} | |
/* Recommandé */ | |
function Customer () { |
App.PostsController = Em.ArrayController.extend({ | |
actions: { | |
create: function () { | |
// some validation logic here | |
return this.send('createPost'); | |
}, | |
save: function (model) { | |
// some validation logic here |