簡體   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