create a function

10 views
Skip to first unread message

abdelouaha...@gmail.com

unread,
Jun 19, 2018, 2:56:42 AM6/19/18
to Angular and AngularJS discussion
I'm a bigenner in angular, and when I create a function inside a class (of a component) like this:
function getTitle():string{
return "Manger product Projects";
}
It is not work. But when I delete a word function it's work. I want juste know why? (TypeScript is a JavaScrite with others features as I know)
Thank you.

jamester go

unread,
Jun 19, 2018, 3:14:20 AM6/19/18
to ang...@googlegroups.com
Can you try to remove the word function ? 

getTitle():string{
      return "Manager Product Projects"
}

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Sander Elias

unread,
Jun 19, 2018, 3:25:04 AM6/19/18
to Angular and AngularJS discussion
Hi Abdelouahab,

You can not put a function in a class like that. that is not allowed by ES2015 syntax.

Regards
Sander 

Bakadiri Abdelouahab

unread,
Jun 21, 2018, 8:50:38 AM6/21/18
to ang...@googlegroups.com
Thank you 

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.

To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
--
Envoyer depuis mon Iphone
Reply all
Reply to author
Forward
0 new messages