83871

Meteor helpers not available in Angular template

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 :

> index.html

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

> foo.ng.html

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

<strong>note:</strong> 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?

(note: see referenced issue.)

** Edit **

Same thing happens when trying to render package templates inside another template :

> index.html

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

> users/usersession.ng.html

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

Then I get Syntax Error: Token '>' not a primary expression at column 1 of the expression [> loginButtons] starting at [> loginButtons].

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

Answer1:

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

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

Your template would be something like:

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

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

Recommend

  • beforeunload event during window close Vs meteor-auto-reload
  • Accessing a csv file with D3 inside meteor
  • What is the variable scope in Meteor client side?
  • Meteor.js mongodb version
  • Angular2 & SystemJS : Cannot find module while building a moduleLoader
  • Accessing 3rd level of JSON with Angular ng-repeat
  • Change attribute of custom directive
  • Angular page doesn't refresh after data is added or removed
  • Slicing an SPA into several components and use AngularJS
  • Not able to display correct data in table -AngularJS
  • to implement a spinner in angular2+
  • Django model for a Postgres view
  • How to retrieve information from antrun back to maven?
  • Function calls are not supported. Consider replacing the function or lambda with a reference to an e
  • Django simple Captcha “No module named fields” error
  • How do I exclude a dependency in provided scope when running in Maven test scope?
  • Is there a perl module to validate passwords stored in “{crypt}hashedpassword” “{ssha}hashedpassword
  • $wpdb not working in file of WordPress plugin
  • PHPUnit_Framework_TestCase class is not available. Fix… - Makegood , Eclipse
  • req.body is undefined - nodejs
  • How to recover from a Spring Social ExpiredAuthorizationException
  • ILMerge & Keep Assembly Name
  • Symfony2: How to get request parameter
  • Why is the timeout on a windows udp receive socket always 500ms longer than set by SO_RCVTIMEO?
  • Build own AppleScript numerical error handling
  • Large data - storage and query
  • Rearranging Cells in UITableView Bug & Saving Changes
  • Akka Routing: Reply's send to router ends up as dead letters
  • WOWZA + RTMP + HTML5 Playback?
  • Is there a mandatory requirement to switch app.yaml?
  • How to get icons for entities from eclipse?
  • Buffer size for converting unsigned long to string
  • Proper way to use connect-multiparty with express.js?
  • Load html files in TinyMce
  • using HTMLImports.whenReady not working in chrome
  • Hits per day in Google Big Query
  • How to get Windows thread pool to call class member function?
  • JaxB to read class hierarchy
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal