Skip to content

Instantly share code, notes, and snippets.

@pavlo-yuriychuk
Created October 22, 2013 20:05
Show Gist options
  • Save pavlo-yuriychuk/7107194 to your computer and use it in GitHub Desktop.
Save pavlo-yuriychuk/7107194 to your computer and use it in GitHub Desktop.
Sample angular app main file skeleton
"use sctrict";
angular.
module("App", ["module1", "module2", "module3"]).
config(["providerName1Provider", "providerName2Provider", function (providerName1Provider, providerName2Provider) {
// Configuration and initialization code here
// Routes
// Initialization of i18n anf i10n
}]).
run(["providerName1", "providerName2", function (providerName1, providerName2) {
// app ready actions
}]);
angular.module("App").
controller("MainMenuCtrl", ["$scope", "$location", function ($scope, $location) {
$scope.method = function () {
//Do something
};
}]);
angular.module("App").
service("CommonDataService", ["$http","$q", function ($http, $q) {
this.authenticate = function (data) {
$http.post(url, data).then(success, failure).then()
};
}])
angular.module("App").
provider("Configuration", ["dataProvider", function (dataProvider) {
function private () {
};
function config (params) {
};
return {
availableInConfig: config,
$get: ["service", function (service) {
return {
availableInInstantiation: call1
}
}]
}
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment