小编JWh*_*Why的帖子

Ember 1.0.0 RESTAdapter失败

我似乎无法追查此错误的来源:

断言失败:没有找到'0'的模型

JSON正在被服务器获取,但是应用程序在发送到模板之前出错了.问题似乎发生在REST适配器和路由器之间.当我使用夹具适配器时,模板呈现无错误.

我正在使用Ember和Handlebars版本1.0.0.

这是我的应用代码:

window.App = Ember.Application.create();

App.ApplicationAdapter = DS.RESTAdapter.extend({
    host: 'http://localhost:3000'
});

App.Router.map(function() {
    this.resource("stories", { path: "/" }, function() {
        this.resource("boards", { path: "/boards"} )
    });
});

App.StoriesRoute = Ember.Route.extend({
    model: function() {
        return this.store.findAll('story');
    }
});

attr = DS.attr;

App.Story = DS.Model.extend({
    color: attr()
});
Run Code Online (Sandbox Code Playgroud)

把手模板

    <script type="text/x-handlebars">
    {{ outlet }}

    </script>

    <script type="text/x-handlebars" data-template-name="stories">
    <ul>
        <li class="storyLine">
            <ul>
                <li id="colorSwatch"></li>
                <li class="board">+</li>
            </ul>
        </li>
    </ul>
    <ul>
    {{#each model}}
        <li class="storyLine">
            <ul>
                <li id="colorSwatch" {{bindAttr class=story.color}}></li> …
Run Code Online (Sandbox Code Playgroud)

ember.js ember-data

13
推荐指数
1
解决办法
3457
查看次数

哪种协议最适合文件传输

我可以用来传输大文件的最佳协议是什么,应该快速可靠?它必须支持低带宽系统,因为我需要跨印度传输文件.文件大小可以是100到500MB.

network-protocols file-transfer

9
推荐指数
2
解决办法
3万
查看次数