Skip to content

Instantly share code, notes, and snippets.

@DiegoSeC
Created July 4, 2013 23:31
Show Gist options
  • Save DiegoSeC/5930822 to your computer and use it in GitHub Desktop.
Save DiegoSeC/5930822 to your computer and use it in GitHub Desktop.
Turnjs and Angularjs, I don't know if this is the best way to do it but You know is much better this than nothing :). Im using AngularUI for the views, if you haven't used it before, well... between us You have to use it jajaja just saying :D!
ALGRAF = angular.module('algraf', ['ui.state'])
ALGRAF.config ($routeProvider, $interpolateProvider, $stateProvider) ->
$interpolateProvider.startSymbol('{[')
$interpolateProvider.endSymbol(']}')
$stateProvider
.state 'index'
url: '/'
views:
'intro':
templateUrl: 'la-empresa'
controller: 'IndexCTRL'
data: page: 1
.state 'servicios'
url: '/servicios'
views:
'ofrecemos':
templateUrl: 'servicios'
controller: 'ServiciosCTRL'
data: page: 2
.state 'faq'
url: '/faq'
views:
'faq':
templateUrl: 'preguntas-frecuentes'
controller: 'PreguntaCTRL'
data: page: 4
ALGRAF.controller 'IndexCTRL', ($scope) ->
ALGRAF.controller 'ServiciosCTRL', ($scope) ->
ALGRAF.controller 'PreguntaCTRL', ($scope) ->
ALGRAF.directive 'turn', ->
(scope, element, $location, attrs) ->
element.turn
display: 'single'
acceleration: true
gradiendts: !$.isTouch
elevation: 150
duration: 2000
scope.$on '$stateChangeSuccess', (event, toState) ->
element.turn('page', toState.data.page)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment