Reputation: 674
I'm receiving an "Unexpected '$scope'" error when I run jSLint against an Angular based app I am building.
Below is a reduced version of the code that is causing the error. You can input the code into the jslint.com website to reproduce the problem.
I don't understand why the first function declaration (downloadFile) doesn't cause an error but the second does (buildFile).
/*jslint browser: true*/
/*global angular */
angular.module('testApp')
.controller('FileCtrl', ["$scope", function ($scope) {
"use strict";
$scope.downloadFile = function () {
window.location = '/path/to/file';
}
$scope.buildFile = function () {
}
}]);
Upvotes: 1
Views: 1483
Reputation: 207527
Lack of semicolons after the function is causing that error
$scope.downloadFile = function () {
window.location = '/path/to/file';
}; //<-- add semicolon
$scope.buildFile = function () {
}; //<-- add semicolon
Upvotes: 6