Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8448263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:22:47+00:00 2026-06-10T10:22:47+00:00

I have a view partial nameplate.jade that has a couple attributes bound from a

  • 0

I have a view partial “nameplate.jade” that has a couple attributes bound from a user object.
On another page I want to see a list of users as seen by their nameplates. So what I would like to do is somehow send either the user or user._id I’ll have from whatever controller I’m in and have it render the nameplate, and then go on to rendering the next one with the first one persisting.

How I’d use it for one nameplate

div(ng-controller="LoginCtrl")
    div(ng-show="logged_in()")
        a(href="/profile/{{ currentUser.handle }}")
            nameplate(user="{{currentUser}}")

How I’d use it if I wanted a list of nameplates

div(ng-repeat="participant in event.participants")
    nameplate(userid="participant.userid")

nameplate.jade

.nameplate

    .imageColumn
        .image
            img(src="{{ user.avatar }}")

    .otherColumn
        .nameRow
            a(ng-href="/profile/{{ user.handle }}") {{ user.handle }}

nameplate directive

.directive('nameplate', (User) ->
        restrict: 'E'
        replace: true
        scope:
            user: '@currentuser'
            userid: '@userid'
        templateUrl: '/partials/nameplate'
        link: (scope, elems, attrs) ->
            # I've tried a lot of things that didn't work here
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T10:22:48+00:00Added an answer on June 10, 2026 at 10:22 am

    I was using user: '@currentuser'
    but I should have been using user: '&currentuser'

    The key was in my directive’s scope hash

    .directive('nameplate', () ->
            restrict: 'E'
            replace: true
            scope:
                user: '&currentuser'
            templateUrl: '/partials/nameplate'
            link: (scope, elems, attrs) ->
                scope.$watch scope.user, (_user) ->
                    scope.user = _user
        )
    

    I was trying to get the {{currentUser}}, but it kept executing in the isolated scope and wasn’t updating when the parent scope’s currentUser changed. So using the ‘scope.$watch’ to listen for value changes and using & instead of @ solved my problems

    From Angularjs Directive Guide

    scope – If set to: {} (object hash)

    • & or &attr – provides a way to execute an expression in the context of the parent scope


    EDIT

    And to elaborate on Andy’s comment below, you can reduce the directive syntax to this:

    .directive('nameplate', () ->
            restrict: 'E'
            replace: true
            scope:
                user: '=currentuser'
            templateUrl: '/partials/nameplate'
        )
    

    With my use case I don’t even need to specify a link function

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view that has a partial view in it, everything works fine,
I have a view that loads a partial view from a controller action using
I have a partial view called Login.ascx that has my login boxes that I
I have a view page with ajax.action link which returns a partial view from
I have a partial view that I want to basically take care of itself
I have a partial view that is shared between two controllers and I'm trying
I have a partial view (UserControl) that implements a simple pager in my Asp.Net
I have a partial view that I have created called noteEditor. That is rendered
I have written a partial view that displays a list of rows, where some
Scenario: I have a View and inside that view I also a partial view.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.