Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jsHint throwing 'Firebase' is not defined warning [duplicate]

how do I define Firebase properly so jshint stops beeping.

My code is working... just jshint is annoy

app.js

 angular
  .module('morningharwoodApp', [
    'firebase',
    'ngAnimate',
    'ngCookies',
    'ngResource',
    'ngRoute',
    'ngSanitize',
    'ngTouch'

  ])

main.js

angular.module('morningharwoodApp')
  .controller('MainCtrl', function ($scope, $firebase) {
    // var Firebase;
    var pageRef = new Firebase('https://morningharwood.firebaseIO.com/page');
    // var pageRef = new Firebase('https://morningharwood.firebaseIO.com/page');


    //init
    $scope.pages = $firebase(pageRef);
    $scope.newPage = {
        title: '',
        slug: '',
        url: '',
        desc: '',
        active: false,
        template: [
            {
                type: ''
            }
        ],
        img: '',
        dateCreated: '',
        dateUpdated: ''

    };

    //CRUD

    //add
    $scope.addPage = function() {
        $scope.pages.$add($scope.newPage);
        $scope.newPage = '';
    };
  });

enter image description here

like image 524
Armeen Harwood Avatar asked Jul 22 '14 05:07

Armeen Harwood


2 Answers

You can also do the following in your jshint.rc

 "jshint_options":
    {
        "predef": {
            "Firebase": false
        }
     }
like image 53
Nikos Avatar answered Oct 18 '22 02:10

Nikos


Since Firebase is supposed to be added to the global object (window), you can use the $window service:

.controller('MainCtrl', function ($firebase, $scope, $window) {
    var pageRef = new $window.Firebase('...');
like image 3
gkalpak Avatar answered Oct 18 '22 04:10

gkalpak