question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't retrieve attributes of the top-level component

See original GitHub issue

http://plnkr.co/edit/5731Z9N6tQ391gQtfZrA?p=preview

I’ve been over the documentation 10 times, I’ve read through the source code, tutorials, the works… and I still can’t wrap my head around what I’m doing wrong.

all I want to do is:

<app myTitle='my awesome title'>  

and access myTitle from inside the constructor.

Is that possible in NG2?

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:36
  • Comments:85 (24 by maintainers)

github_iconTop GitHub Comments

26reactions
Mewelcommented, Sep 4, 2015

you can use the ElementRef:

constructor(public elementRef: ElementRef) {
    var native = this.elementRef.nativeElement;
    var myattr = native.getAttribute("myattr");
}
24reactions
mheverycommented, Apr 10, 2016

I would like to take some time to comment on the tone of some of the messages. I am sorry that Angular does not do everything you want yet. The issue is still open because we may be able to do it in the future. I get that one is disappointed when the framework does not do X or Y yet and we will be improving as soon as we can. Please form your comments in a constructive way which help the situation. Making negative statements, even if hinting create the same feelings in the reader and that affects the person’s mood. This makes the reader think about the feelings rather than focusing on solving the problem.

Please be courteous to each other. We all our doing our best.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get the value from tkinter toplevel in side a 0 attribute ...
This is a top level window in tkinter and I want to get the value 1,2,3 when I click the radio button and...
Read more >
Attributes — h5py 3.7.0 documentation
Attributes are a critical part of what makes HDF5 a “self-describing” format. They are small named pieces of data attached directly to Group...
Read more >
Explore component properties - Figma Help Center
A variant property allows you to define attributes of your variants, such as state, color, or size. A component set contains multiple variants,...
Read more >
Using Global Secondary Indexes in DynamoDB
When you query the index, DynamoDB can retrieve these projected attributes efficiently. However, global secondary index queries cannot fetch attributes from ...
Read more >
How to Make Frames (Main Windows) (The Java™ Tutorials ...
A frame, implemented as an instance of the JFrame class, is a window that has decorations such as a border, a title, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found