私は新しくウェブ開発には新しく、一般的にウェブ開発には新しくなっています。Ember.js:どのモデル()のフックがコントローラに戻ってきているのかアクセスできません
私はアクションデータベースから「テーマ」からのもので、入力タイトルとキーワードを比較し、「ブラウズ」を通じていくつかのページにリダイレクトしようとしている燃えさし
の最新リリースで働いています(Firebase)。 もし一致すれば、私のページを見ることができます。もしそうでなければ、私はエラーを投げます。ここ
コードは、
Index.hbs
<div class="jumbotron">
<div class="container">
<form>
<div class="form-group">
<label for="inputTheme">Theme</label>
{{input type="theme" value=inputTheme class="form-control" id="inputTheme" placeholder="Theme"}}
</div>
<div class="form-group">
<label for="inputKeyword">Password</label>
{{input type="password" value=inputKeyword class="form-control" id="inputKeyword" placeholder="Keyword"}}
</div>
<button class='btn btn-info' {{action 'browse'}}>Browse</button>
</form>
</div>
</div>
index.js(コントローラ)
import Ember from 'ember';
export default Ember.Controller.extend({
isDisabled: true,
inputTheme: '',
inputKeyword: '',
actions: {
browse() {
this.transitionToRoute("/themes/:theme_id/browse");
}
}
});
index.js(ルート)
import Ember from 'ember';
export default Ember.Route.extend({
model()
{
this.store.query('theme', {
orderBy: 'title',
equalTo: this.get('inputTitle')
}).then(function(data) {
return data.get('firstObject');
});
}
});
ルータであります.js
01私は動的に照会することはできませんので、私はルートから "inputTitle" へのアクセスを持っていない1):
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: config.locationType
});
Router.map(function() {
this.route('about');
this.route('contact');
this.route('browse', { path: '/themes/:theme_id/browse'});
this.route('admin', function() {
this.route('contacts');
});
this.route('themes', function() {
this.route('new');
this.route('edit', { path: '/:theme_id/edit'});
this.route('browse', { path: '/:theme_id/browse'});
});
});
export default Router;
Theme.js(モデル)
import Ember from 'ember';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
export default Model.extend({
title: attr('string'),
keyword: attr('string'),
master: attr('string'),
description: attr('string'),
});
事があります。私がそれをするとき、私は必要なものを得るのが難しいですが。
2)コントローラからモデルにアクセスしようとすると、何もないことがわかります。
私は何を欠席しましたか? どうしたのですか?ここで
は、現在のApp
https://euretest.firebaseapp.com/
へのリンクは、あなたの助けを事前にありがとうございます:)