0

I'm trying to implement a Facebook provider (angular-facebook.js) as show in the below plnkr:

http://plnkr.co/edit/dDAmvdCibv46ULfgKCd3?p=preview

However, I've made a bit of a hash with my config files. The plnkr example doesn't use a route provider so I'm unsure how to structure my .config to both utilize the route provider and initialize my Facebook implementation:

Current but Not Working

'use strict';
var myApp = angular.module('myApp ', ['facebook'])
.config(
    ['FacebookProvider',
    function(FacebookProvider){
        var myAppId = '4605923966';

        FacebookProvider.init(myAppId);
    },
    function($routeProvider)
    {
        $routeProvider.when('/admin/area',
        {
            templateUrl: 'app/admin/area/index.html'
        });

    }]
);

1 Answer 1

1

The method config only takes one function as a parameter, so you need to inject both FacebookProvider and $routeProvider into it like this:

'use strict';

var myApp = angular.module('myApp ', ['facebook'])
.config(['FacebookProvider', '$routeProvider',
    function(FacebookProvider, $routeProvider) {
        var myAppId = '4605923966';

        FacebookProvider.init(myAppId);

        $routeProvider.when('/admin/area', {
            templateUrl: 'app/admin/area/index.html'
        });
    }]);
Sign up to request clarification or add additional context in comments.

1 Comment

Legend, thank you. I did try something similar but I think I forgot to pass the '$routeProvider' into the start of the .config- thanks again!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.