Lots of tweaks, and angular demos

This commit is contained in:
Max Lynch
2013-08-24 14:14:45 -05:00
parent ae59de54bd
commit d9f1c23ee1
15 changed files with 195 additions and 33 deletions

27
example/angular/app.css Normal file
View File

@ -0,0 +1,27 @@
.pane {
position: fixed;
width: 100%;
}
.reveal-animation {
/*
-webkit-transform: translate3d(0%, 0, 0);
transform: translate3d(0%, 0, 0);
-webkit-transition: -webkit-transform 1s ease-in-out;
transition: transform 1s ease-in-out;
*/
}
.reveal-animation.ng-enter {
-webkit-transition: 0.2s linear all;
-webkit-transform:translate3d(100%,0,0) ;
}
.reveal-animation.ng-enter-active {
-webkit-transform:translate3d(0,0,0) ;
}
.reveal-animation.ng-leave {
-webkit-transition: 0.2s linear all;
-webkit-transform:translate3d(0,0,0);
}
.reveal-animation.ng-leave-active {
-webkit-transform:translate3d(-100%,0,0);
}

47
example/angular/app.js vendored Normal file
View File

@ -0,0 +1,47 @@
document.addEventListener('touchstart', function() {});
var app = angular.module('peopleApp', ['ngRoute', 'ngAnimate']);
app.config( ["$routeProvider", function($routeProvider){
$routeProvider.when("/customers", {"templateUrl" : "customers.html", controller: 'CustomersCtrl'});
$routeProvider.when("/customer/:id", {"templateUrl" : "customer.html", controller: 'CustomerCtrl'});
$routeProvider.otherwise({"redirectTo":"/customers"});
}]
);
app.provider('Customers', function() {
var customers = [
{'name': 'Max Lynch', id: 1},
{'name': 'Max Lynch', id: 2},
{'name': 'Max Lynch', id: 3},
{'name': 'Max Lynch', id: 4},
{'name': 'Max Lynch', id: 5},
{'name': 'Max Lynch', id: 6},
{'name': 'Max Lynch', id: 7},
{'name': 'Max Lynch', id: 8},
{'name': 'Max Lynch', id: 9},
{'name': 'Max Lynch', id: 10},
{'name': 'Max Lynch', id: 11},
];
this.$get = function() {
return {
list: customers,
getById: function(id) {
for(var i = 0; i < this.list.length; i++) { if(this.list[i].id == id) return this.list[i]; }
}
}
}
});
app.controller('CustomersCtrl', function($scope, Customers) {
$scope.customers = Customers;
});
app.controller('CustomerCtrl', function($scope, $routeParams, Customers) {
var id = $routeParams.id;
var customer = Customers.getById(id);
$scope.customer = customer;
console.log('Showing user', id, customer);
});

View File

@ -0,0 +1,3 @@
<h2>{{customer.name}}</h2>
<a class="button button-default">Edit</a>
<a class="button button-danger">Delete</a>

View File

@ -0,0 +1,6 @@
<ul class="list" ng-controller="CustomersCtrl">
<a href="#customer/{{customer.id}}" class="list-item" ng-repeat="customer in customers.list">
{{customer.name}}
<i class="icon-arrow-right"></i>
</a>
</ul>

View File

@ -0,0 +1,27 @@
<html>
<head>
<meta charset="utf-8">
<title>Example</title>
<!-- Sets initial viewport load and disables zooming -->
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<link rel="stylesheet" href="../../dist/framework-with-theme.css">
<link rel="stylesheet" href="app.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular-route.min.js"></script>
<script src="http://code.angularjs.org/1.2.0rc1/angular-animate.js"></script>
<script src="app.js"></script>
</head>
<body ng-app="peopleApp">
<header class="bar bar-header bar-dark">
<h1 class="title">Customers</h1>
</header>
<main class="content" ng-controller="CustomersCtrl">
<div ng-view class="pane reveal-animation"></div>
</main>
</body>
</html>