Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Gallery Module
- *
- * Declare the gallery module here, specify dependencies
- * and configure the module.
- */
- 'use strict';
- /* @ngInject */
- function config($stateProvider) {
- $stateProvider
- .state('gallery-view', {
- url: '/photo-gallery-flip/:slug/:slide',
- scrollTo: 'top',
- controller: 'GalleryCtrl',
- controllerAs: 'gallery',
- resolve: GalleryCtrl.resolve,
- templateUrl: '/assets/js/angular-src/app/gallery/gallery-view.tpl.html'
- });
- }
- angular
- .module('app.gallery', [
- 'ui.router',
- 'ngResource'
- ])
- .config(config);
- /**
- * Gallery Controller
- *
- * This is where your gallery business logic will go. This file
- * should not get bloated. Try and keep majority of code & logic
- * in your services.
- */
- 'use strict';
- /* @ngInject */
- function GalleryCtrl($stateParams, GalleryService, gallery) {
- this.gallery = gallery;
- ...
- };
- /**
- * Before the Gallery is instantiated, resolve some dependencies,
- * like requesting the gallery from the api.
- */
- GalleryCtrl.resolve = {
- fetch: function($stateParams, GalleryService) {
- return GalleryService.fetch($stateParams.slug);
- },
- gallery: function($stateParams, GalleryService) {
- return GalleryService.getGallery($stateParams.slug);
- }
- };
- angular
- .module('app.gallery')
- .controller('GalleryCtrl', GalleryCtrl);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement