本文介绍了在角模板不可用流星助手的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我学习,然后我想补充的国际化支持挖掘:18n内包。不幸的是,模板辅助函数 _ 是没有棱角的模块里面availble的。例如:

I am learning Meteor and I'm trying to add internationalization support with the tap:18n package. Unfortunately, the template helper function _ is not availble inside Angular modules. For example

<div>{{_ "foo"}}</div>

的工作原理,但不使用的模块模板中时,它

works, but does not when using it inside a module template :

<div ng-app="app" ng-include="'foo.ng.html'">

> foo.ng.html

<div ng-app="bar">
  <div>{{_ "bar"}}</div>
</div>

注意: 应用声明在 foo.js angular.module('应用',['角流星']); ,在项目的根级

note: app is declared inside foo.js as angular.module('app', ['angular-meteor']);, in the project root level.

时有可能使角模块内提供佣工?

Is it possible to make helpers available inside Angular modules?

(注:参见参考)

同样的事情发生:

<section ng-app="users"
         ng-include="'users/usersession.ng.html'">
</section>

>用户/ usersession.ng.html

<ul class="nav navbar-nav navbar-right">
  {{> loginButtons}} <!-- here -->
</ul>

然后我得到语法错误:令牌'&GT;'不是主要的前$的前pression [的制造&gt 1 P列$ pssion; loginButtons]在[&GT开始; loginButtons]

注意:模块用户定义,一切工作正常,而不 {{&GT; loginButtons}} 前pression。

Note: the module users is defined and everything works fine without the {{> loginButtons}} expression.

推荐答案

您可以使用里面的。尝试是这样的:

You can use meteor templates inside angular. Try something like:

<meteor-include src="myTemplate"></meteor-include>

您的模板会是这样的:

<template name="myTemplate">
    <div>{{_ "foo"}}</div>
</template>

记住命名.html文件时,角模板将name.ng.html和流星模板将只是name.html

Remember when naming .html files, the angular templates will be name.ng.html and the meteor templates will just be name.html

这篇关于在角模板不可用流星助手的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 16:17
查看更多