TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Chris Anderson
NA
93
9.3k
Move method from component to custom directives using keyup
Apr 1 2021 7:19 AM
Hi!
I've multiple places where I want to use the logic from the same method for ng-keyup. I came across custom directives which seem to be what I'm looking for.
Some dummy code below. How can I move the method from the x-component.ts to z-directive.ts?
x-component.html
<textarea #msg (keyup)="color(msg)"
></textarea>
x-component.ts:
Just a dummy using color
color(textArea: HTMLTextAreaElement){
this
.el.nativeElement.style ="color;
}
z-directive.ts
How can the code above be translated and used from this z-directive.ts instead?
Reply
Answers (
0
)
How to read JSON file and display on web page using angular js ?
Iframe : how to pass username & password