javascript - ReferenceError: $setTimeout is not defined -


i'm doing course , ran across , error. i'm making tinder producthunt using ionic , angular.

ionic $ 0     776918   error    referenceerror: $settimeout not defined     @ scope.$scope.sendfeedback (http://localhost:8100/js/controllers.js:41:5)     @ fn (eval @ <anonymous> (http://localhost:8100/lib/ionic/js/ionic.bundle.js:26457:15), <anonymous>:4:239)     @ http://localhost:8100/lib/ionic/js/ionic.bundle.js:62386:9     @ scope.$eval (http://localhost:8100/lib/ionic/js/ionic.bundle.js:29158:28)     @ scope.$apply (http://localhost:8100/lib/ionic/js/ionic.bundle.js:29257:23)     @ htmlanchorelement.<anonymous> (http://localhost:8100/lib/ionic/js/ionic.bundle.js:62385:13)     @ htmlanchorelement.eventhandler (http://localhost:8100/lib/ionic/js/ionic.bundle.js:16583:21)     @ triggermouseevent (http://localhost:8100/lib/ionic/js/ionic.bundle.js:2948:7)     @ tapclick (http://localhost:8100/lib/ionic/js/ionic.bundle.js:2937:3)     @ htmldocument.tapmouseup (http://localhost:8100/lib/ionic/js/ionic.bundle.js:3013:5) 

this console log ionic serve when run animation. heres code

angular.module('thunder.controllers', ['ionic', 'thunder.services'])  .controller('discoverctrl', function($scope, $timeout) {   $scope.products = [     {       "name": "linkedin profinder",       "tagline": "a new way hire freelancers linkedin",       "discussion_url": "https://www.producthunt.com/tech/linkedin-profinder-2",       "thumbnail": "https://api.url2png.com/v6/p5329c1fa0ecb6/77fdeb2d4df2c4813d5c61384b22a33f/png/?thumbnail_max_width=850&url=https%3a%2f%2fgoo.gl%2f1jusiw",       "product_url": "https://www.producthunt.com/r/0109266759e0f0/40894?app_id=1948"     },     {       "name": "k blocker",       "tagline": "kardashian content blocker ios",       "discussion_url": "https://www.producthunt.com/tech/k-blocker",       "thumbnail": "https://api.url2png.com/v6/p5329c1fa0ecb6/d7a68a8f35cda14414482f82a266e4ac/png/?thumbnail_max_width=850&url=http%3a%2f%2fkblocker.co",       "product_url": "https://www.producthunt.com/r/1239ed9df03056/40854?app_id=1948"     },     {       "name": "hangoverapp",       "tagline": "share photos friends, visible when you're together",       "discussion_url": "https://www.producthunt.com/tech/hangoverapp",       "thumbnail": "https://api.url2png.com/v6/p5329c1fa0ecb6/f05f2b63763cc446bef17ba748c9e14a/png/?thumbnail_max_width=850&url=http%3a%2f%2fwww.hangoverapp.com",       "product_url": "https://www.producthunt.com/r/8a94554894f2bb/40912?app_id=1948"     },     {       "name": "43 layers",       "tagline": "teespring event decorations , gifts",       "discussion_url": "https://www.producthunt.com/tech/43-layers",       "thumbnail": "https://api.url2png.com/v6/p5329c1fa0ecb6/ec770fa05c7ce60a4e07ccc074dddf28/png/?thumbnail_max_width=850&url=https%3a%2f%2fwww.43layers.com%2fproducts%2fspecial%2fproduct-hunt",       "product_url": "https://www.producthunt.com/r/b704ae84e992e1/41413?app_id=1948"     }   ];   $scope.currentproduct = angular.copy($scope.products[0]);    $scope.sendfeedback = function(bool) {      $scope.currentproduct.rated = bool;     $scope.currentproduct.hide = true;      $settimeout(function () {       var randomproduct = math.round(math.random() * ($scope.products.length - 1))        $scope.currentproduct = angular.copy($scope.products[randomproduct]);     }, 250);    } }) .controller('favouritesctrl', function($scope) {}) .controller('tabs ctrl', function($scope) {}) 

i've been trying solve error past hour, i'd highly appreciate help!

not sure if $settimeout angular service. try using $timeout instead.

angularjs version of settimeout $timeout , setinterval $interval.

see official documentation more details: https://docs.angularjs.org/api/ng/service/$timeout


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -