How to use yield and Iron-router?

后端 未结 2 1836
醉梦人生
醉梦人生 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条回答
  • 2021-01-27 08:27

    I figured out the answer to my own question after searching around stackoverflow at other iron-router questions.. I have no idea why it worked, but it solved the issue. All I had to do was run:

    meteor add ejson
    

    and I no longer got my error.

    Here is the question that answered my question (which was posted AFTER my question): Iron:router 1.0.9 Not working

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题