Calling function immedietaly at AngularJS

I am totally newbie to AngularJs.

I have pretty good example of ngClick which is calling a Facebook function.

I would like to change it and programmatically to call registerWithFacebook function after my controller will be ready. What is the way for it?

Here is the sample: http://jsfiddle.net/IgorMinar/Hxbqd/5/

    angular.module('HomePageModule', []).service('facebookConnect', function($rootScope) {
        this.askFacebookForAuthentication = function(fail, success) {
            FB.login(function(response) {
                if (response.authResponse) {
                    FB.api('/me', function() { $rootScope.$apply(success) });
                } else {
                   $rootScope.$apply(function() {
                     fail('User cancelled login or did not fully authorize.')
                   });
                }
            });
        }
});

function ConnectCtrl(facebookConnect, $scope, $resource) {

    $scope.user = {}
    $scope.error = null;

    $scope.registerWithFacebook = function() {
        facebookConnect.askFacebookForAuthentication(
        function(reason) { // fail
            $scope.error = reason;
        }, function(user) { // success
            $scope.user = user
        });
    }

    // Tried this but no success
    // $scope.registerWithFacebook();
}

ConnectCtrl.$inject = ['facebookConnect', '$scope', '$resource'];

Thanks

If you want to load the FB library asynchronously, you need to let angular know after it initializes. Here is one way to do it:

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