Uncaught Error: Couldn't find a Layout component in the rendered component tree

StackOverflow https://stackoverflow.com/questions/22771486

  •  25-06-2023
  •  | 
  •  

Вопрос

I'm receiving an error with Iron Router 0.7.0 on Meteor 0.8.0.

Within the UI.Compenent.lookup function in blaze-layout's layout.js, the following error is triggering:

Uncaught Error: Couldn't find a Layout component in the rendered component tree

It's hard to know exactly what is causing this error and what isn't working because of it. Any ideas?

Thanks in advance.

Это было полезно?

Решение

I just got the same error, for me it was caused by including my layout template within <body>, and specifying it as the layoutTemplate option. To fix it, I removed the include from <body>.

Here is a before and after of my code;

example.html (before)

<head>
  <title>example</title>
</head>

<body>
   {{>layout}}
</body>

<template name="layout">
    <div>{{>yield}}</div>
</template>

example.js (before)

if(Meteor.isClient) {

Router.configure({
    layoutTemplate: 'layout'
});

}

example.html (after)

<head>
  <title>example</title>
</head>

<body>
</body>

<template name="layout">
    <div>{{>yield}}</div>
</template>

example.js (after -- same as before)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top