ドキュメント サイトにある Sammy.js チュートリアルに従おうとしていますが、テンプレートをレンダリングしようとすると、次のようにスローされます。
Uncaught SyntaxError: Unexpected token ) sammy.template-latest.min.js:5
クロムで。そして Firefox では:
[14:55:55.136] SyntaxError: 行方不明; 前のステートメント @ mysitehere/workspace/scripts/vendor/sammy/plugins/sammy.template-latest.min.js:5
私のアプリケーションスクリプトは次のとおりです。
(function($) {
var app = $.sammy('#main', function() {
this.use('Template');
this.around(function(callback) {
var context = this;
this.load('data/items.json')
.then(function(items) {
context.items = items;
})
.then(callback);
});
this.get('#/', function(context) {
context.app.swap('');
$.each(this.items, function(i, item) {
context.render('templates/item.template', {id: i, item: item})
.appendTo(context.$element());
});
});
});
$(function() {
app.run('#/');
});
})(jQuery);
マークアップでは、インポートしました:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="scripts/vendor/sammy/sammy-latest.min.js" type="text/javascript" charset="utf-8"></script>
<script src="scripts/vendor/sammy/plugins/sammy.template-latest.min.js" type="text/javascript" charset="utf-8"></script>
<script src="scripts/vendor/sammy/plugins/sammy.json-latest.min.js" type="text/javascript" charset="utf-8"></script>
<script src="scripts/application/application.js" type="text/javascript" charset="utf-8"></script>
これらはすべて 200 として解決されます。
私のテンプレート パスは検証され、github リポジトリからコピーされます。
http:// プロトコルではないデータをプルするための Chrome の問題である可能性があると聞きましたが、FF でも試してみましたが、役に立ちませんでした。
何か案は?