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
Dev Teywa
NA
250
40.1k
how to add item from array to class using angular2
Jan 24 2018 11:05 AM
Hello,
I have a user class
export
class
User
{
constructor
(
public
email
:
string
,
public
password
:
string
) {
this
.
email
=
email
;
this
.
password
=
password
}
}
I'm storing the values of this class in an array like this
users
:
User
[]= [
new
User
(
'
[email protected]
'
,
'adm9'
),
new
User
(
'
[email protected]
'
,
'a23'
)
];
after I create an add_user function that allows to add a user
add_user
(
user
:
User
)
{
this
.
users
.
push
(
the problem is here
);
console
.
log
(
this
.
users
);
this
.
_router
.
navigate
([
'login'
]);
}
ho can i do please ?
thanks in advance
Reply
Answers (
3
)
How To pass value from 2forms on angular2
how to compare values using angular...