Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- angular.module('Application', ['onsen', 'ngRoute'])
- .config(['$compileProvider', function ($compileProvider) {
- $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|tel):/);
- }])
- .config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
- $routeProvider
- .when('/', {
- controller: 'MainController',
- templateUrl: tplUrl + 'main/main.html'
- })
- .when('/users', {
- controller: 'UserController',
- templateUrl: tplUrl + 'user/user.html'
- });
- }])
- .controller('IndexController', function () {
- var vm = this;
- vm.toggle = toggle;
- function toggle() {
- menu.toggleMenu();
- }
- })
- .factory('StorageFactory', function () {
- return {
- 'set': function (key, value) {
- var data = null;
- if (angular.isArray(value) || angular.isObject(value)) {
- data = JSON.stringify(value);
- }
- localStorage.setItem(key, data);
- },
- 'get': function (key) {
- var data = localStorage.getItem(key);
- if (data) {
- try {
- data = JSON.parse(data);
- } catch (e) {
- }
- return data;
- } else {
- return null;
- }
- },
- 'rm': function (key) {
- localStorage.removeItem(key);
- }
- }
- });
Add Comment
Please, Sign In to add comment