0

So the iron-router github page says this:

Latest Version: 0.8.2

IMPORTANT: Do not install versions 0.9.0 or 0.9.1 from Atmosphere. These versions are intended for the new Meteor packaging system available in Meteor v0.9.0. iron-router 0.9.x was released by mistake to Atmosphere.

When I run meteor list in my project directory I get this:

standard-app-packages  1.0.1  Moved to meteor-platform
iron:router            0.9.3  Routing specifically designed for Meteor
d3                     1.0.0  Library for manipulating documents based on data
less                   1.0.8  The dynamic stylesheet language
accounts-password      1.0.1  Password support for accounts
jquery                 1.0.0  Manipulate the DOM using CSS selectors
http                   1.0.5  Make HTTP calls to remote servers

meteor --version shows me this:

Meteor 0.9.2.2

I installed iron-router, according to the instruction on the same github page that the above quote is taken from, as follows:

meteor add iron:router

When I run my app I'm being give the following error message in the browser console:

No Iron.Layout found so you can't use yield! 

My layout template looks like this:

<template name='advantage_layout'>
    <div id='advantage-nav'>
        <div id='user-control'>
            <div id='brand-username'>
                Advantage: {{username}}
            </div>
            <div id='user-buttons'>
                <button id='settings-button' class='user-button'>Settings</button>
                <button id='logout-button' class='user-button'>Logout</button>
            </div>
        </div>
        {{>nav}}
    </div>

    <div id='advantage-content'>
        {{> yield}}
    </div>
</template>

I configure the router like this:

var mustBeSignedIn = function(pause) {
    if (!Meteor.user()) {
        // render the login template but keep the url in the browser the same
        this.render('login');
        // pause this rendering of the rest of the before hooks and the action function 
        pause();
    }
}

// this hook will run on almost all routes
Router.onBeforeAction(mustBeSignedIn, {except: ['login']});

Router.configure({
    loadingTemplate: 'loading',
    layoutTemplate: 'advantage_layout'
})

Router.map(function() {
    this.route('user_settings', {
        path: 'user-settings/',
        layoutTemplate: 'advantage_layout',
        template: 'user_settings',
    });
});

Help.

tadasajon
  • 14,276
  • 29
  • 92
  • 144
  • All of this looks good except for the error. Did you add a `layoutTemplate` as shown [here](https://github.com/EventedMind/iron-router#layouts--rendering)? – David Weldon Sep 23 '14 at 22:01
  • yes, I am using a layout template -- I've added details to the question. – tadasajon Sep 23 '14 at 22:27
  • 1
    Don't worry about the `0.9.0` comment on the IR page, it's there for legacy reasons for projects that still use Meteor < 0.9 and Atmosphere. – Hubert OG Sep 24 '14 at 07:18
  • Did you get this working? Is it possible that you do not have a template for "user_settings" ?? – Jason Leidigh Jan 02 '15 at 18:01

0 Answers0