Use Blaze UI Component sAlert in Meteor 1.2.1 with Angular

↘锁芯ラ 提交于 2019-12-25 02:48:16

问题


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:


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.



来源:https://stackoverflow.com/questions/33907348/use-blaze-ui-component-salert-in-meteor-1-2-1-with-angular

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!