Skip to content

Commit bdac600

Browse files
committed
Update demos
1 parent 3dfa172 commit bdac600

12 files changed

+47
-56
lines changed

example/web/animation.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ part 'animation/visibility_demo.dart';
99
part 'animation/stress_demo.dart';
1010
part 'animation/css_demo.dart';
1111

12-
@Controller(
13-
selector: '[animation-demo]',
14-
publishAs: 'demo')
12+
@Controller(selector: '[animation-demo]')
1513
class AnimationDemo {
1614
final pages = ["About", "ng-repeat", "Visibility", "Css", "Stress Test"];
1715
var currentPage = "About";

example/web/animation.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
</head>
77
<body class="ng-cloak" ng-app animation-demo>
88
<nav>
9-
<button ng-repeat="page in demo.pages"
10-
ng-click="demo.currentPage = page"
11-
ng-class="{'current': demo.currentPage == page}">
9+
<button ng-repeat="page in pages"
10+
ng-click="currentPage = page"
11+
ng-class="{'current': currentPage == page}">
1212
{{page}}
1313
</button>
1414
</nav>
15-
<div class="content" ng-switch="demo.currentPage">
15+
<div class="content" ng-switch="currentPage">
1616
<div class="demo" ng-switch-default>
1717
<h2>About</h2>
1818
<p>The NgAnimate module is a port with modifications of the original

example/web/animation/css_demo.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ part of animation;
44
selector: 'css-demo',
55
template: '''
66
<div class="css-demo">
7-
<button ng-click="ctrl.stateA = !ctrl.stateA"
8-
ng-class="{'active': ctrl.stateA}">
7+
<button ng-click="stateA = !stateA"
8+
ng-class="{'active': stateA}">
99
Toggle A</button>
10-
<button ng-click="ctrl.stateB = !ctrl.stateB"
11-
ng-class="{'active': ctrl.stateB}">
10+
<button ng-click="stateB = !stateB"
11+
ng-class="{'active': stateB}">
1212
Toggle B</button>
13-
<button ng-click="ctrl.stateC = !ctrl.stateC"
14-
ng-class="{'active': ctrl.stateC}">
13+
<button ng-click="stateC = !stateC"
14+
ng-class="{'active': stateC}">
1515
Toggle C</button>
1616
<div class="box-container">
1717
<div class="css-box" ng-class="{
18-
'a': ctrl.stateA,
19-
'b': ctrl.stateB,
20-
'c': ctrl.stateC}">BOX</div>
18+
'a': stateA,
19+
'b': stateB,
20+
'c': stateC}">BOX</div>
2121
</div>
2222
</div>
2323
</div>

example/web/animation/repeat_demo.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ part of animation;
44
selector: 'repeat-demo',
55
template: '''
66
<div class="repeat-demo">
7-
<button ng-click="ctrl.addItem()">Add Thing</button>
8-
<button ng-click="ctrl.removeItem()">Remove Thing
9-
</button>
7+
<button ng-click="addItem()">Add Thing</button>
8+
<button ng-click="removeItem()">Remove Thing</button>
109
<ul>
11-
<li ng-repeat="outer in ctrl.items">
10+
<li ng-repeat="outer in items">
1211
<ul>
13-
<li ng-repeat="inner in ctrl.items">{{inner}}</li>
12+
<li ng-repeat="inner in items">{{inner}}</li>
1413
</ul>
1514
</li>
1615
</ul>

example/web/animation/stress_demo.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ part of animation;
44
selector: 'stress-demo',
55
template: '''
66
<div class="stress-demo">
7-
<button ng-click="ctrl.visible = !ctrl.visible">
7+
<button ng-click="visible = !visible">
88
Toggle Visibility</button>
99
<div>
10-
<div class="stress-box" ng-repeat="number in ctrl.numbers"></div>
10+
<div class="stress-box" ng-repeat="number in numbers"></div>
1111
</div>
1212
</div>
1313
''',

example/web/animation/visibility_demo.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ part of animation;
44
selector: 'visibility-demo',
55
template: '''
66
<div class="visibility-demo">
7-
<button ng-click="ctrl.visible = !ctrl.visible">Toggle Visibility</button>
8-
<div class="visible-if" ng-if="ctrl.visible">
7+
<button ng-click="visible = !visible">Toggle Visibility</button>
8+
<div class="visible-if" ng-if="visible">
99
<p>Hello World. ng-if will create and destroy
1010
dom elements each time you toggle me.</p>
1111
</div>
12-
<div class="visible-hide" ng-hide="ctrl.visible">
12+
<div class="visible-hide" ng-hide="visible">
1313
<p>Hello World. ng-hide will add and remove
1414
the .ng-hide class from me to show and
1515
hide this view of text.</p>

example/web/bouncing_balls.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ class BallModel {
2626

2727
}
2828

29-
@Controller(
30-
selector: '[bounce-controller]',
31-
publishAs: 'bounce')
29+
@Controller(selector: '[bounce-controller]')
3230
class BounceController {
3331
var lastTime = window.performance.now();
3432
var run = false;

example/web/bouncing_balls.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,30 @@
3939
<body ng-app>
4040
<div bounce-controller>
4141
<div class="balls">
42-
<div ng-repeat="ball in bounce.balls"
43-
class="{{bounce.ballClassName}}"
42+
<div ng-repeat="ball in balls"
43+
class="{{ballClassName}}"
4444
ball-position="ball"></div>
4545
</div>
4646

4747
<div>
4848
<div class="fps-bar">
49-
<div class="fps" ng-style-width="bounce.fps*4 + 'px'"></div>
49+
<div class="fps" ng-style-width="fps * 4 + 'px'"></div>
5050
</div>
5151
</div>
5252

5353
{{bounce.fps}} fps. ({{bounce.balls.length}} balls) [{{1000/bounce.fps}} ms] <br>
5454
Digest: {{bounce.digestTime}} ms<br>
55-
<a href ng-click="bounce.changeCount(1)">+1</a>
56-
<a href ng-click="bounce.changeCount(10)">+10</a>
57-
<a href ng-click="bounce.changeCount(100)">+100</a>
55+
<a href ng-click="changeCount(1)">+1</a>
56+
<a href ng-click="changeCount(10)">+10</a>
57+
<a href ng-click="changeCount(100)">+100</a>
5858
<br>
59-
<a href ng-click="bounce.changeCount(-1)">-1</a>
60-
<a href ng-click="bounce.changeCount(-10)">-10</a>
61-
<a href ng-click="bounce.changeCount(-100)">-100</a>
59+
<a href ng-click="changeCount(-1)">-1</a>
60+
<a href ng-click="changeCount(-10)">-10</a>
61+
<a href ng-click="changeCount(-100)">-100</a>
6262
<br>
63-
<a href ng-click="bounce.playPause()">&#x25B6;&#10073;&#10073;</a> <br>
64-
<a href ng-click="bounce.toggleCSS()">Toggle CSS</a><br>
65-
<a href ng-click="bounce.timeDigest()">noop</a><br>
63+
<a href ng-click="playPause()">&#x25B6;&#10073;&#10073;</a> <br>
64+
<a href ng-click="toggleCSS()">Toggle CSS</a><br>
65+
<a href ng-click="timeDigest()">noop</a><br>
6666
</div>
6767

6868
<script type="application/dart" src="bouncing_balls.dart"></script>

example/web/hello_world.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import 'package:angular/angular.dart';
22
import 'package:angular/application_factory.dart';
33

4-
@Controller(
5-
selector: '[hello-world-controller]',
6-
publishAs: 'ctrl')
4+
@Controller(selector: '[hello-world-controller]')
75
class HelloWorld {
86
String name = "world";
97
}

example/web/hello_world.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
</head>
66
<body hello-world-controller>
77

8-
<h3>Hello {{ctrl.name}}!</h3>
9-
name: <input type="text" ng-model="ctrl.name">
8+
<h3>Hello {{name}}!</h3>
9+
name: <input type="text" ng-model="name">
1010

1111
<script type="application/dart" src="hello_world.dart"></script>
1212
<script src="packages/browser/dart.js"></script>

example/web/todo.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ class HttpServer implements Server {
5454
}
5555

5656

57-
@Controller(
58-
selector: '[todo-controller]',
59-
publishAs: 'todo')
57+
@Controller(selector: '[todo-controller]')
6058
class Todo {
6159
var items = <Item>[];
6260
Item newItem;

example/web/todo.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@
1515
<h2>Things To Do ;-)</h2>
1616

1717
<div class="right">
18-
<button ng-click="todo.markAllDone()" class="btn btn-small">mark all done</button>
19-
<button ng-click="todo.archiveDone()" class="btn btn-small">archive done</button>
18+
<button ng-click="markAllDone()" class="btn btn-small">mark all done</button>
19+
<button ng-click="archiveDone()" class="btn btn-small">archive done</button>
2020
</div>
2121

22-
<p>Remaining <b>{{todo.remaining()}}</b> of <b>{{todo.items.length}}</b> items.</p>
22+
<p>Remaining <b>{{ remaining() }}</b> of <b>{{ items.length }}</b> items.</p>
2323

2424

2525
<ul class="well unstyled">
26-
<li ng-repeat="item in todo.items" ng-class="todo.classFor(item)">
26+
<li ng-repeat="item in items" ng-class="classFor(item)">
2727
<label class="checkbox">
2828
<input type="checkbox" ng-model="item.done"> {{item.text}}
2929
</label>
3030
</li>
3131
</ul>
3232

3333
<form class="form-inline" onsubmit="return false;">
34-
<input type="text" ng-model="todo.newItem.text">
35-
<button ng-click="todo.add()" ng-disabled="todo.newItem.isEmpty" class="btn btn-primary">add</button>
36-
<button ng-click="todo.newItem.clear()" ng-disabled="todo.newItem.isEmpty" class="btn">clear</button>
34+
<input type="text" ng-model="newItem.text">
35+
<button ng-click="add()" ng-disabled="newItem.isEmpty" class="btn btn-primary">add</button>
36+
<button ng-click="newItem.clear()" ng-disabled="newItem.isEmpty" class="btn">clear</button>
3737
</form>
3838
</div>
3939
</body>

0 commit comments

Comments
 (0)