Avatar of MrChrisDavids
MrChrisDavids
 asked on

Connect two scopes in AngularJS - kind of

So I'm just starting out with AngularJS and I've got two scopes defined in a controller. In the view I want to have a sort of lookup to the second scope. How's that done?

So more or less - the variable at..

<div class="panel-note">{{ servers.install_id }}</div>

Open in new window

needs to be replaced with {{ notes.installation }} where notes.id = servers.install_id

I hope it makes sense?
JavaScriptjQuery

Avatar of undefined
Last Comment
MrChrisDavids

8/22/2022 - Mon
Kyle Hamilton

not sure how you can have two scopes in one controller.  a controller has one scope - that's kind of a basic premise of angular. there are situations where you might end up with some nested scopes within your app, but you would never "define" two scopes in the controller

it's not clear what you are trying to acheive.

can you explain on a higher level what the requirement is, and/or, provide a plunker or jsfiddle with the code in question
ASKER CERTIFIED SOLUTION
ambience

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
MrChrisDavids

ASKER
Indeed it's two variables in a scope - nothing else. Sorry about the mixup there.

I have a dynamic list of servers shown as panels on a view. There are some details on these servers that are common for certain sets and those are the ones that I'd like to render on the view

The details are however accessed from another datasource and the only matches are some IDs from the servers panel that can be matched if they're valid for detail_x kind of.

Let's say, for instance - 20 servers are used for application XYZ which is identified by ID 1. All servers come in with a variable servers.app_id = 1 and I'd then like to write out "XYZ" on the panel instead of the ID.

There's plenty of different IDs that would be replaced, not just the app and notes.

I'll have a look at a directive - see if I can get that working. Thanks!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck