How to use yield and Iron-router?

后端 未结 2 1861
醉梦人生
醉梦人生 2021-01-27 08:00

So I am trying to do a basic meteor app at the moment.. here are the three files.

router.js:

Router.configure({
    layoutTemplate : \'layout\',
    load         


        
2条回答
  •  萌比男神i
    2021-01-27 08:36

    The exception isn't very relevant, but I see two possibilities:

    • You forgot the template attribute in your Route.route();
    • Your router configuration file isn't in the right folder

    For the first one:

    Router.route("/", {
        name : "homeIndex",
        template : "homeIndex",
        data : function() {
            return {
                message : "Welcome to the Rocket Shop"
            }
        }
    });
    

    For the second one: make sure your router.js file is in client/lib/ folder.

    Also, make sure that you have the iron-router package in the .meteor/packages.js file.

提交回复
热议问题