gpt4 book ai didi

javascript - 验证 Ember.js 架构

转载 作者:行者123 更新时间:2023-11-30 18:11:09 25 4
gpt4 key购买 nike

我正在努力适应 Ember.js 架构的布局。有人可以就构建我的应用程序的最合适方式给我提示和技巧吗?

<html>
<head>
<script src="../script/library/jquery.js"></script>
<script src="../script/library/handlebars.js"></script>
<script src="../script/library/ember.js"></script>
<script>
$(document).ready(function(){
Application = Ember.Application.create();

Application.ApplicationView = Ember.View.extend({
templateName: 'application'
});

Application.ApplicationController = Ember.Controller.extend();

Application.Cat = Ember.Object.extend({
name: null,
breed: null
});

Application.CatView = Ember.View.extend({
templateName: 'catCreate'
});

Application.CatController = Ember.Controller.extend({
content: null,
create: function() {
alert("controller uploading: " + this.get('content').name);
}
});

Application.Router = Ember.Router.extend({
root: Ember.Route.extend({
createCat: Ember.Route.extend({
route: '/',
connectOutlets: function(router) {
router.get('applicationController').connectOutlet('cat', Application.Cat.create());
}
})
})
});

Application.initialize();
});

</script>
</head>
<body lang="en">
<script type="text/x-handlebars" data-template-name="application">
{{outlet}}
</script>

<script type="text/x-handlebars" data-template-name="catCreate">
<h1>Cat Detail</h1>
{{view Ember.TextField id="name" valueBinding="content.name"}}<br/>
{{view Ember.TextField id="breed" valueBinding="content.breed"}}<br/>
<button {{action "create" target="controller"}}>Done</button>
</script>
</body>
</html>

最佳答案

看看这个问题:Could someone point me to an ember.js project that uses the latest routing system? Bonus points if it uses ember-data as well有一些不错的应用示例。

我个人非常喜欢这个:

https://github.com/trek/ember-todos-with-build-tools-tests-and-other-modern-conveniences

它让您很好地了解如何构建文件并使用现代工具开发和部署应用。

关于javascript - 验证 Ember.js 架构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14561729/

25 4 0
文章推荐: javascript - 如何在javascript IE中通过文本查找选项值
文章推荐: javascript - 使用 javascript 在同一选项卡中打开 url
文章推荐: javascript - 快照 View windows 8 javascript
文章推荐: javascript - 单击
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com