我试图在一个角流星应用程序中使用useraccounts:bootstrap
,方法是使用urigo:angular-blaze-template
包来使用useraccounts:bootstrap
提供的烈焰模板{{> atForm}}
。
问题:--我在网页上得到一个错误: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
取消注释blaze-html-templates
中的.meteor/packages
给出了错误
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
发布于 2015-12-17 11:02:15
把你的火焰模板放在另一个文件中,就像你把你的角度html放在那里一样。也就是说,将<template>
放在另一个文件中,<blaze-template>
将保留在您的角html文件中。
useraccounts.html
<blaze-template name="todoList"></blaze-template>
useraccounts_blaze.html
<template name="todoList">
{{> atForm}}
</template>
另见:https://stackoverflow.com/a/34073593/5543045
更新和检查atForm是否存在:
如果您想要检查atForm或任何其他模板是否是由blaze-template找到的,您可以添加一个简单的模板助手来尝试查找模板名。类似于:
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>
https://stackoverflow.com/questions/34341389
复制相似问题