Im new in AngularJS. Please can you help with resolving problem with $timeout in Angular JS 1.8. I have some course on Udemy, but i think its little outdated :(. Many thanks for your help. PS: Sorry for my english.
//index
<body>
<div ng-app="myApp" ng-controller="myAppCtrl">
<h1>Hello {{ name }}</h1>
</div>
</body>
//app.js
var myApp = angular.module("myApp", []);
myApp.controller("myAppCtrl", function ($scope, $timeout) {
$scope.name = "John";
$timeout([function () {
console.log("Peter");
}], 3000);
});
Many thaks for your time.
Change
$timeout([function () {
console.log("Peter");
}], 3000);
To this
$timeout(function() {
console.log("Peter");
), 3000);