[英]How pass parameter to helpers using angular-meteor without blaze template
[英]Using Blaze Template in Angular Meteor
我試圖使用useraccounts:bootstrap
通過使用在角流星應用urigo:angular-blaze-template
包使用火焰模板{{> atForm}}
通過提供useraccounts:bootstrap
。
問題:我在網頁上遇到錯誤: meteorTemplate: There is no template with the name 'todoList'
。 有任何想法嗎?
useraccounts.html
<template name="todoList">
{{> atForm}}
</template>
<blaze-template name="todoList"></blaze-template>
routes.js
angular.module('myApp').config(function($urlRouterProvider, $stateProvider, $locationProvider) {
$locationProvider.html5Mode(true)
$stateProvider
.state('useraccounts', {
url: '/useraccounts',
templateUrl: 'client/useraccounts/views/useraccounts.html',
})
$urlRouterProvider.otherwise('/foo')
})
遵循Jos Jarink的建議,缺少的模板錯誤消失了! 但是{{> atForm }}
不包含任何內容,僅包含嵌套在uiView
div
的以下代碼。
blaze-html-templates
軟件包已被刪除,將其添加回似乎沒有任何區別。
<div class="container">
<!-- uiView: -->
<div ui-view="" class="ng-scope">
<blaze-template name="atForm" class="ng-scope">
<div class="at-form ng-scope">
</div>
</blaze-template>
</div>
</div>
Github回購: https : //github.com/nyxynyx/useraccounts-angular
在.meteor/packages
取消注釋blaze-html-templates
會給出錯誤
Errors prevented startup: While determining active plugins:
error: conflict: two packages included in the app (angular-templates and templating) are both trying to handle *.html
將您的Blaze模板放置在另一個文件中,就像放置Angular html一樣。 也就是說,將<template>
放在另一個文件中, <blaze-template>
保留在Angular html文件中。
useraccounts.html
<blaze-template name="todoList"></blaze-template>
useraccounts_blaze.html
<template name="todoList">
{{> atForm}}
</template>
另請參閱: https : //stackoverflow.com/a/34073593/5543045
更新並檢查atForm的狀態:
如果要檢查blaze-template是否找到了atForm或其他模板,則可以添加一個簡單的模板助手來嘗試查找模板名稱。 就像是:
Template.todoList.helpers({
isThatTemplateHere: function (name) {
var tmpl = Template[name];
if (tmpl)
return name + ' was found';
else
return name + ' was not found';
}
});
在您的模板中:
<template name="todoList">
{{isThatTemplateHere "atForm"}}
{{> atForm}}
</template>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.