How can I call an inner method from outside a controller in AngularJS?
var app;
(function (){
app = angular.module("gallery", []);
app.controller("galleryController", ['$scope','$http', function($scope, $http){
var gallery = this;
gallery.data = [];
gallery.getJson = function(){
$http.get('/urltojson/main-hero.json').success(function(data){
gallery.data = data;
});
}
this.getJson();
}]); })();
Is it possible to call the getJson method from outside the controller?