Home ()=> over function() throwing me an Angular error
Reply: 0

()=> over function() throwing me an Angular error

user1697 Published in March 21, 2018, 8:36 pm

This question already has an answer here:

  • What does “this” refer to in arrow functions in ES6? 5 answers

Ok so I'm currently trying to create a registration process following a MEAN stack tutorial and I've started using ()=>{} functions over the old syntax.

Now when I used the old syntax as follows

    .controller('regCtrl', function(){
    this.regUser = function(){


The code runs fine and doesn't throw me any errors in the console however when I use the new function syntax

.controller('regCtrl', ()=>{
  this.regUser = ()=>{

I receive this in the console log

angular.js:14700 TypeError: Function.prototype.bind.apply(...) is not a constructor
    at Object.instantiate (angular.js:5055)
    at angular.js:11015
    at Object.link (angular-route.js:1214)
    at angular.js:1385
    at wa (angular.js:10545)
    at q (angular.js:9934)
    at f (angular.js:9174)
    at angular.js:9039
    at angular.js:9430
    at d (angular.js:9217) "<h2 ng-view="" class="ng-scope">"

I'm can only assume that this an issue that is within angularjs or that I've syntaxed incorrectly however I am unable to see the issue.

My apologies if this seems like rookie mistake I'm quite an inexperienced coder.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.303074 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO