Advertisement
vafrcor

Foundation for App angular.js

Nov 29th, 2015
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ...
  2. angular.module("application").controller("DefaultController", ["$scope", "$stateParams", "$state", function($scope, $stateParams, $state) {
  3.     var params = [];
  4.     angular.forEach($stateParams, function(value, key) {
  5.         params[key] = value
  6.     }), $scope.params = params, $scope.current = $state.current.name, $state.current.views ? ($scope.vars = $state.current.data.vars, $scope.composed = $state.current.data.vars.children) : $scope.vars = $state.current.data.vars
  7. }]), angular.module("application").controller("NavController", ["$scope", "$state", function($scope, $state) {
  8.     $scope.current = $state.current.name;
  9.     var routes = angular.copy(foundationRoutes);
  10.     $scope.routing = [], $scope.typedText = "", foundationRoutes && angular.forEach(routes, function(r) {
  11.         var title = r.title || r.name.replace(".", " ");
  12.         $scope.routing.push(title)
  13.     }), $scope.selectRoute = function(routeName) {
  14.         var name = routeName.replace(" ", ".");
  15.         angular.forEach(routes, function(r) {
  16.             return r.title && r.title === routeName ? void $state.go(r.name) : name === r.name ? void $state.go(r.name) : void 0
  17.         })
  18.     }
  19. }]), angular.module("application").controller("MotionUIController", ["$scope", "$state", "FoundationApi", "$animate", "$window", function($scope, $state, FoundationApi, $animate, $window) {
  20.     $scope.current = $state.current.name, $scope.element = {}, $scope.speeds = ["linear", "ease", "easeIn", "easeOut", "easeInOut", "bounceIn", "bounceOut", "bounceInOut"], $scope.transitions = [{
  21.         direction: "enter",
  22.         type: "Slide",
  23.         classes: ["slideInDown", "slideInUp", "slideInLeft", "slideInRight"]
  24.     }, {
  25.         direction: "leave",
  26.         type: "Slide",
  27.         classes: ["slideOutBottom", "slideOutUp", "slideOutLeft", "slideOutRight"]
  28.     }, {
  29.         direction: "enter",
  30.         type: "Fade",
  31.         classes: ["fadeIn"]
  32.     }, {
  33.         direction: "leave",
  34.         type: "Fade",
  35.         classes: ["fadeOut"]
  36.     }, {
  37.         direction: "enter",
  38.         type: "Hinge",
  39.         classes: ["hingeInFromTop", "hingeInFromBottom", "hingeInFromRight", "hingeInFromLeft", "hingeInFromMiddleX", "hingeInFromMiddleY"]
  40.     }, {
  41.         direction: "leave",
  42.         type: "Hinge",
  43.         classes: ["hingeOutFromTop", "hingeOutFromBottom", "hingeOutFromRight", "hingeOutFromLeft", "hingeOutFromMiddleX", "hingeOutFromMiddleY"]
  44.     }, {
  45.         direction: "enter",
  46.         type: "Scale",
  47.         classes: ["zoomIn"]
  48.     }, {
  49.         direction: "leave",
  50.         type: "Scale",
  51.         classes: ["zoomOut"]
  52.     }, {
  53.         direction: "enter",
  54.         type: "Spin",
  55.         classes: ["spinIn", "spinInCCW"]
  56.     }, {
  57.         direction: "leave",
  58.         type: "Spin",
  59.         classes: ["spinOut", "spinOutCCW"]
  60.     }], $scope.update = function() {
  61.         var kitty = angular.element('<img id="kitty" src="http://placekitten.com/g/600/300" />'),
  62.             presentKitty = $window.document.getElementById("kitty"),
  63.             demoElementParent = $window.document.getElementById("demo-card-parent"),
  64.             animationClasses = "";
  65.         for (prop in $scope.element) "default" !== $scope.element[prop] && "undefined" !== $scope.element[prop] && (animationClasses += $scope.element[prop] + " ");
  66.         kitty.addClass(animationClasses), "enter" === $scope.animationFilter ? (presentKitty && presentKitty.remove(), $animate.enter(kitty, demoElementParent).then(function() {
  67.             kitty.removeClass(animationClasses)
  68.         })) : ($animate.enter(kitty, demoElementParent), $animate.leave(kitty), presentKitty && presentKitty.remove())
  69.     }
  70. }]);
  71. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement