File tree 2 files changed +19
-35
lines changed
2 files changed +19
-35
lines changed Original file line number Diff line number Diff line change 11
11
< h1 > Angular</ h1 >
12
12
13
13
< div ng-app ="app ">
14
-
15
- < input type ="text " ng-model ="model.prop1 "> < br />
16
- < input type ="text " ng-model ="model.prop2 "> < br />
17
- < input type ="text " ng-model ="model.prop3 ">
18
-
19
- < zippy attrfoo ="{{model.prop1}} " attrbar ="{{model.prop2}} "> <!-- grabs data from chrisProp -->
20
- <!-- NOTE: content that is transcluded has access to parent scope.
21
- This is how model.content is available to the view
22
- -->
23
- < p > Third input is : "{{model.prop3}}". First input is "{{model.prop1}}".</ p >
24
- </ zippy >
25
-
14
+ < div ng-controller ="AppCtrl "> </ div >
26
15
</ div >
27
16
28
-
29
17
< script src ="js/angular.js "> </ script >
30
18
< script src ="js/app.js "> </ script >
31
-
32
-
33
19
</ body >
34
20
</ html >
Original file line number Diff line number Diff line change 1
1
// Define an App
2
2
var app = angular . module ( 'app' , [ ] ) ;
3
3
4
- app . directive ( 'zippy' , function ( ) {
5
- return {
6
- restrict : 'E' ,
7
- transclude : true ,
8
- scope : {
9
- attrfoo : '@' ,
10
- attrbar : '@'
11
- } ,
12
- templateUrl : 'templates/zippy_template.html' ,
4
+ app . controller ( 'AppCtrl' , function ( $scope , $q ) {
13
5
14
- link : function ( scope ) {
15
- scope . isContentVisible = false ;
6
+ var defer = $q . defer ( ) ;
16
7
17
- scope . toggleContent = function ( ) {
18
- scope . isContentVisible = ! scope . isContentVisible ;
19
- console . log ( 'toggleContent Fired' ) ;
20
- } ;
8
+ defer . promise
9
+ . then ( function ( weapon ) {
10
+ alert ( 'You can have my ' + weapon ) ;
11
+
12
+ return 'bow' ;
13
+ } )
14
+ . then ( function ( weapon ) {
15
+ alert ( 'And my ' + weapon ) ;
16
+
17
+ return 'axe' ;
18
+ } )
19
+ . then ( function ( weapon ) {
20
+ alert ( 'As well as my ' + weapon ) ;
21
+ } )
22
+
23
+ defer . resolve ( 'sword' ) ;
21
24
22
- scope . myFunc = function ( ) {
23
- console . log ( 'myfunct Fired' ) ;
24
- } ;
25
- }
26
- } ;
27
25
} ) ;
You can’t perform that action at this time.
0 commit comments