ember-cli のサンプルを探す
イシュー
- とりあえず、ember-cli のお作法を学ぶ
参考
- Getting started with Ember and Ember Data using Ember CLI · Baruch Lubinsky
- Ember.js Tutorials on EmberWatch
- tutorial がいっぱい♪
- Top 5 Best Beginner Tutorials For Ember.js
- Setting up Ember.js with Rails - Nando Vieira
- Creating an Ember app - App Center | MDN
- Dynamically Render Components in Ember.js 1.11
- ember cli addon update - YouTube
- Write Your Next Web App With Ember CLI – Smashing Magazine
ember-cli todo tutorial
command: generate todo resource
$ sane generate resource todo title:string isCompleted:boolean info: Created a new model ("Todo") at api/models/Todo.js! info: Created a new controller ("todo") at api/controllers/TodoController.js! version: 0.1.12 Could not find watchman, falling back to NodeWatcher for file system events installing create app/models/todo.js installing create tests/unit/models/todo-test.js installing create app/routes/todo.js create app/templates/todo.hbs installing create tests/unit/routes/todo-test.js $
watchman
- Watchman | A file watching service
- Watchman installed but Ember-CLI can't find it - Ember CLI - Ember.JS
- インストール後に再起動必要
1.x 系のインストール
- Release Mulligan, Part Deux · ember-cli/ember-cli · GitHub
- @指定なしだと、2.x系がインストールされます。
ember-cli の heroku deploy
参考
- Deploy emberjs app on heroku - Nepal on Rails
- Deploy ember-cli + rails app in heroku? - Stack Overflow
- tonycoco/heroku-buildpack-ember-cli · GitHub
- ここのbuildpackを設定すると herokuでbowerが動きます。
- Deploying an ember-cli app to Heroku - Demo Apps Only! - Brendan Graetz
- ember.js - Deploying ember-cli app to Heroku - Stack Overflow
- HerokuのBuildpackを利用してmbstringが有効なPHPサーバを立ててみた - hnwの日記
- Ember CLI — A command line utility for creating ambitious web applications
buildpack 追加
heroku config:set BUILDPACK_URL=https://github.com/tonycoco/heroku-buildpack-ember-cli.git
他のリソースサーバに接続
Refused to connect to 'http://localhost:1337/api/v1/todos' because it violates the following Content Security Policy directive: "connect-src 'self' ws://localhost:35729 ws://0.0.0.0:35729".
- hoge/app/adapters/application.js に host を追加するとJSエラー
import DS from 'ember-data'; export default DS.RESTAdapter.extend({ coalesceFindRequests: true, namespace: 'api/v1', host: 'http://localhost:1337' });
- ember.js - Violating Content Security Policy directive after ember-cli 0.0.47 upgrade - Stack Overflow
- Content Security Policy Reference & Examples
access control allow origin
- 続 クロスドメインで使う XMLHttpRequest と CORS の話 | 日頃の行い
- SEO - WEBページに設定しておくと良いHTTPヘッダとかメタタグとか - Qiita
- ember.js - Setting CORS for static files on ember-cli server - Stack Overflow
すばらしきTodoアプリ
emberJs と ember-cliとの違い
<ul id="todo-list"> {{#each}} <li {{bind-attr class="isCompleted:completed"}}> {{input type="checkbox" checked=isCompleted class="toggle"}} <label>{{title}}</label><button class="destroy"></button> </li> {{/each}} </ul>
- emberJs(js/controllers/todo_controller.js)
{{#each itemController="todo"}} <li {{bind-attr class="isCompleted:completed"}}> {{input type="checkbox" checked=isCompleted class="toggle"}} <label>{{title}}</label><button class="destroy"></button> </li> {{/each}}
Todos.TodoController = Ember.ObjectController.extend({ isCompleted: function(key, value){ var model = this.get('model'); if (value === undefined) { // property being used as a getter return model.get('isCompleted'); } else { // property being used as a setter model.set('isCompleted', value); model.save(); return value; } }.property('model.isCompleted') });