Mercer
Mercer

Reputation: 9986

JSHint some errors

Why JSHint say me:

JSHint: Missing semicolon (W033) For the 'use strict' and

JSHint: 'myApp' is not defined. (W117)

controller.js:

'use strict'
myApp.controller('NavbarCtrl', function NavbarController($scope, $location) {
    $scope.routeIs = function (routeName) {
        return $location.path() === routeName;
    };
});
...

Upvotes: 0

Views: 313

Answers (2)

Bikas
Bikas

Reputation: 2759

You've already opened a similar question and now this. Please ask all similar question in single post.

Here's the updated code that'll work for you.

/* global myApp*/ //if myApp is defined in some file globally.
'use strict';

var myApp; // if myApp is not defined earlier.
myApp.controller('NavbarCtrl', function NavbarController($scope, $location) {
    $scope.routeIs = function (routeName) {
        return $location.path() === routeName;
    };
});
...

Upvotes: 1

Rahul Tripathi
Rahul Tripathi

Reputation: 172548

Both the errors are self explanatory.

JSHint: Missing semicolon (W033) For the 'use strict' and

Add the semicolon after use strict;

JSHint: 'myApp' is not defined. (W117)

It means the myApp is not defined. You can simply define it like this:

var myApp

Upvotes: 1

Related Questions