我是新使用角与流星(使用angular-with-blaze),并曾使用AutoForm以前与火焰。
创建autoForm of type="update"时,必须将对象作为doc参数传入
{{#autoForm collection="Fruits" id="updateFruit" type="update" doc=fruit}}
...
{{/autoForm}}问题:如何将文档fruit传递给autoForm助手?我应该使用角度控制器还是火焰模板助手?
我也在使用ui.router
$stateProvider
.state('editFruit', {
url: '/editFruit/:fruit_id',
templateUrl: 'client/fruits/views/edit-fruit.ng.html'
})更新
试图使用火焰的模板助手,但它似乎并没有把物体传递给火焰模板。也许这个特性还没有实现,或者我的代码不正确。
Template.updateFruitForm.helpers({
fruit: function () {
var href = window.location.href ;
var fruit_id = href.substr(href.lastIndexOf('/') + 1);
return Fruits.findOne({_id: fruit_id});
}
});发布于 2015-12-25 15:51:54
我已经写了一个关于在这里的指令- http://www.angular-meteor.com/api/1.3.1/blaze-template#passingargumentstoblazetemplate中发送参数来点燃模板的部分。
基本上,你需要:
https://stackoverflow.com/questions/34446770
复制相似问题