Code Monkey home page Code Monkey logo

Comments (6)

calledit avatar calledit commented on May 4, 2024

it should be:

<template name="user">
<div class='navbar'>
<img src="logo.svg" />
<h1>Logged In {{firstName}}</h1>
</div>
</template>

Using user.firstname syntax would make it very hard for meteor do know what it is working on.

from meteor.

olivoil avatar olivoil commented on May 4, 2024

I get the same issue.

@callesg In the example above, calling <h1>Logged In {{user.firstName}}</h1> makes sense. The attribute name comes from the template function Template.navbarLoggedIn.user, hence {{user.firstName}} and not just {{firstName}}

from meteor.

calledit avatar calledit commented on May 4, 2024

@olivoil I get that it makes sense.
However (not saying this is not an issue in some way)

  1. Having that would make it so that one template would be able to have more that one dependency. It may not be a problem by itself, but imagine all the complications that it would bring such as interfering dependencies.(AKA application bugs)
  2. It basically only adds complexity such as(two ways to do one thing (the way i explained being one)), without any real benefits. Simplicity is nice.

Well that is my view of it.

from meteor.

prognostikos avatar prognostikos commented on May 4, 2024

Have you tried using {{this.firstName}} instead?

from meteor.

olivoil avatar olivoil commented on May 4, 2024

you can also use {{#with}} :

<template name="navbarLoggedIn">
<div class='navbar'>
<img src="logo.svg" />
{{#with user}}
  <h1>Logged In {{firstName}}</h1>
{{/with}}
</div>
</template>

from meteor.

dgreensp avatar dgreensp commented on May 4, 2024

Fixed on devel branch. You can now use nested paths on template properties, whether they are constants or getter functions.

from meteor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.