我已经加载了jQuery传输,我确保在加载jQuery之后我做了,但我仍然得到这个错误:
我查看了Chrome中的资源面板,并在jQuery之后加载了jQuery传输.它也正确加载,并显示没有问题.
我还在控制台中进行了测试,测试了网站上的示例.他们都返回同样的错误.
这是我的代码:
  $("#current-employers a.industry-company-link").click(function (e)
    {
        e.preventDefault();
        var url = $(this).attr("href");
        var company_container = $("#current-company-profile");
        company_container.load(url);
        company_container.transition({
            y: ($(this).offset().top - company_container.offset().top)
        });
        console.log("container offset: " + company_container.offset().top + "\nURL offset: " + $(this).offset().top);
    });
Run Code Online (Sandbox Code Playgroud)
我带来的脚本:
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.0/jquery-1.8.0.min.js"></script>
        <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.transit/0.1.3/jquery.transit.min.js"></script>
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助.
我们希望使用 prettier强制 />删除HTML 中自闭合标签之前的任何额外空格。从选项来看,我们找不到任何相关选项来禁用此行为。
我们如何在自关闭标签之前强制不添加额外空格/>:使用 prettier?
我想从路由重定向/new,并保留路由的查询参数new:
据我所知,唯一可以进入的地方queryParams是model路线的钩子.
但我想重新定位beforeModel钩子:
import Ember from "ember";
export default Ember.Route.extend({
    /**
     * @@override
     * Implicitly create a new applicant, redirecting to the generated ID at /applications/#{id}
     * @param transition
     */
    beforeModel: function(transition) {
        var emptyApplicant = this.store.createRecord("applicant",
                {isPrimary: true}
            ),
            emptyApplication = this.store.createRecord("application");
        emptyApplication.set("applicant", emptyApplicant);
        emptyApplicant.save().then((savedApplicant) => {
            emptyApplication.save().then((savedApplication) => {
                this.transitionTo("applications", savedApplication);
            });
        });
    }
});
Run Code Online (Sandbox Code Playgroud)
虽然上面的代码有效,但转换将在不保留查询参数的情况下完成.例如,导航到applicants/new?agent=35不会保留agent=35在查询参数中,而只是重定向到applicants/new.
如何 …
我刚开始使用javascript代码使用MIDI,因此我想创建一个仅根据用户输入生成MIDI文件的应用程序。我已经看过使用MIDI.js了,但是我不确定是否需要任何库。理想情况下,我希望能够使用音符值而不是十六进制MIDI代码...我需要在其中使用转换器plugin.js吗?
我目前的研究表明,生成声音字体是建议的方法。但是,我想导出/生成用于专业DAW的MIDI文件。
谢谢你的帮助。
似乎store在我的Ember测试中无法使用,无论是ObjectController在任何单元测试中还是在任何单元测试中.我的单元测试:
`import {test, moduleFor} from "ember-qunit"`
`import DS from "ember-data"`
moduleFor "controller:register", "RegisterController", {
}
test "store is working", ->
    expect 1
    controller = @subject()
    Ember.run(->
        sampleUser = controller.get("store").createRecord("user", {
            username: "myuser"
            password: "otherpassword"
        })
        ok(sampleUser instanceof DS.Model)
    )
Run Code Online (Sandbox Code Playgroud)
测试将给出:
死于试验#1试验(
http://localhost:4200/assets/vendor.js:73539:13)在EVAL(应用程序/测试/单元/控制器/注册-test.js:19:5)在requireModule(http://localhost:4200/assets/vendor.js:54:29)在http://localhost:4200/assets/test-loader.js:14:29:无法读取属性'createRecord'空的
任何人都可以解释为什么我无法DS从我的测试中或控制器本身(运行测试时)访问功能?
ember.js ×2
javascript ×2
coffeescript ×1
ember-cli ×1
ember-data ×1
format ×1
html ×1
jquery ×1
midi ×1
prettier ×1
redirect ×1
unit-testing ×1