Use Blaze UI Component sAlert in Meteor 1.2.1 with

2019-09-19 19:59发布

I had a working Meteor App with Angular and Blaze before the 1.2.1 Update came out, but now it´s not possible anymore to use for example

{{>sAlert}}

in my Application.

There is a helper package called "angular-with-blaze", where you have the possibility to include Blaze templates, and I thought I´d wrap the {{>sAlert}} into a custom template, and load it with

<template name="custom">
    {{>sAlert}}
</template>
<blaze-template name="custom"></blaze-template>

But it tells me, that the template wasn´t found.

So what is now the way to go for including such components in my meteor based angular app?

1条回答
兄弟一词,经得起流年.
2楼-- · 2019-09-19 20:41

Your approach is correct. Put the sAlert template helper in a blaze template and render that template with blaze-template. But you need to put the blaze-template line in your angular html file and the actual Blaze template in another html file where you only put your Blaze templates.

example-list.ng.html:

<div>
    <header>
        <h1>Sample</h1>
    </header>

    <blaze-template name="test1"></blaze-template>
    <blaze-template name="test2"></blaze-template>
</div>

And another file for your Blaze templates: blaze-templates.html:

<template name="test1">
    {{> sAlert}}
    Hello {{visitor}}
</template>

<template name="test2">
    Hello {{customer}}
</template>

* because I render both test1 and test2 to the same page, only test1 can have the sAlert template helper. If on different pages, repeat the template helper. But that is not part of your question, it is how sAlert works.

查看更多
登录 后发表回答