Problem with angular-templates

Upgraded to latest meteor METEOR@1.3.4.4 and I started having problem with:

Error: [angular-meteor][err][404] client/login/login.view.html - HTML template does not exists!

I tried deleting .meteor folder and reinstalling, meteor reset uninstall and reinstall angular-templates
but with no success. What could be the problem?

+1 I reported a very similar issue here

Yes it seams that we have same issue! If i find solution i will post back here.

I have tried it out with my boilerplate no issues so far.

+1

Same issue ! I’ve even ran $ meteor update --release 1.3.4.3 and the error is still there. If anyone have found a workaround, please share :slight_smile:

I’ve just encountered the same issue and after some investigation, I found out that the problem was there’s no template cache being generated. I’ve fixed it by importing every single html templates.

E.g. folder structure

  • client
  • app.routes.js
  • login
    login.view.html
    login.js

E.g. app.routes.js

import templateUrlLogin from ./login/login.view.html
...

$stateProvider
        .state('login', {
            url: '/login',
            templateUrl: templateUrlLogin,
            controller: 'LoginCtrl'
        });

@albertonaperijr thank you for your help resolving this issue!

Manualy importing all templates may not be option with many templates. Which package was doing it so far? angular-templates?

Maybe this is related to the fact that during my updade to meteor 1.3.4.4
angular2-html-templates@0.5.4 was uninstalled and
urigo:static-html-compiler@0.1.4 was installed?

For me the workaround was to downgrade the project-dependencies to the previous v1.3.4.1 state.

@sauermann Yes, that’s basically the cause of the issue.
@otporsad If you don’t want to import every single html templates, you can just downgrade it to the previous version.

and

issues are raised on github that are relevant to this problem.

With 1.3.4.4 and the current versions of angular2 tooling you should use

import template from './template.html'

Since the default export is no longer a URL but the template content. Though this breaks backward compatibility, it is better in a way since it reduces a level of indirection (i.e. using $templateCache) to get the template.

Yes we are aware of the problem and are on it, in the meantime please pin the previous version of angular-templates

+1 same issue I think. I cannot get Angular2 and Meteor to work together at all. Any import of html template fails. Routing fails.

import template from './app.html'; //fails with: Cannot find module './app.html'

Routing fails with

EXCEPTION: Error: Uncaught (in promise): Error: Cannot find primary outlet to load ‘HomePage’

I am using @Urigo 's tutorial here to get started with Angular2 and Meteor
https://www.angular-meteor.com/tutorials/socially/angular2/routing-and-multiple-views

Could somebody please tell me how to get this working? Have spent days on this. How to downgrade, what to downgrade. I do not see any package “angular-templates” in any of the example code or tutorial code. Thanks!

1 Like

Hi, I face the same issue Cannot find module ‘./app.html’, still do not have a solution unfortunately

@hadarg i downgraded to 1.0.3 but not working for me. Giving the same 404 “HTML template does not exists!”. Can you please write the steps though which you solved the issue.

Got the same problem
Downgrade to angular-templates@1.0.3 from 1.0.7 and it’s solve the problem
@Urigo, anyupdate with a correction?

We just released a new 1.0.8_1 version, can you please check if that works for you?

removing angular-templates@1.0.3 and installing the latest 1.0.8_1 didnt help solving the issue. Maybe following the tutorial in a new directory from scratch solve the issue with @1.0.8_1. I will you on this @Urigo. Currently it is giving the same error in console.

It should be fixed after we merge https://github.com/Urigo/angular-meteor/pull/1412

It supports all the use cases listed here https://github.com/kamilkisiela/angular-templates-test

About issues with files from directories other than imports. You can add import './path/to/file.html' to your project so angular-templates won’t lazy load it.

To make things clear.

What’s a main template? A file that contains <body/> and <head/> elements
What’s a template? A file to be used with components etc

Let’s say you have a file client/main.html and it contains <body> element so it’s your main template.
You don’t have to import it because the compiler checks if it is a main template, if so it’s being used in your app automatically.

Modules are created only for templates.

For example:

client/main.html

<head>
  <title>My app</title>
</head>
<body>
  <app></app>
</body>

client/app.html

<div>Your app is running!</div>

client/main.js

import angular from 'angular';
import angularMeteor from 'angular-meteor';

// do not import `./main.html`
import templateUrl from './app.html';

angular.module('app', [angularMeteor])
  .component('app', {
    templateUrl // it's a shortcut for templateUrl: templateUrl
  });

angular.element(document).ready(
  () => angular.bootstrap(document.body, ['app'])
);