繁体   English   中英

在角流星中使用Blaze模板

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM