mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-06 22:29:44 +08:00
Lots of tweaks, and angular demos
This commit is contained in:
27
example/angular/app.css
Normal file
27
example/angular/app.css
Normal 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
47
example/angular/app.js
vendored
Normal 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);
|
||||
});
|
||||
3
example/angular/customer.html
Normal file
3
example/angular/customer.html
Normal file
@ -0,0 +1,3 @@
|
||||
<h2>{{customer.name}}</h2>
|
||||
<a class="button button-default">Edit</a>
|
||||
<a class="button button-danger">Delete</a>
|
||||
6
example/angular/customers.html
Normal file
6
example/angular/customers.html
Normal 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>
|
||||
27
example/angular/index.html
Normal file
27
example/angular/index.html
Normal 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>
|
||||
Reference in New Issue
Block a user