File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change 13
13
< h1 id ="" class ="text-center " style ="margin: 100px; ">
14
14
{{title}}
15
15
</ h1 >
16
- < button class ="btn btn-success " style ="margin-bottom: 15px; "> 查看浏览器network里的请求情况 </ button >
16
+ < button class ="btn btn-success " style ="margin-bottom: 15px; " ng-click =" vm.open() " > 开启测试 </ button >
17
17
< div class ="content ">
18
- < img src ="" ng-repeat ="item in imgs track by $index " data-ui-lazyload ="{{item}} " watch ="watch "/>
18
+ < input ng-model ="vm.oldVal " ng-if ="vm.start ">
19
+ < input ng-model ="newVal " ng-if ="vm.oldVal ">
20
+ </ div >
21
+ < div class ="content ">
22
+ < input ng-model ="vm.oldVal " ng-if ="vm.start ">
23
+ < input ng-model ="newVal " ng-if ="vm.oldVal ">
24
+ </ div >
25
+ < div class ="content ">
26
+ < input ng-model ="vm.oldVal " ng-show ="vm.start ">
27
+ < input ng-model ="newVal " ng-show ="vm.oldVal ">
19
28
</ div >
20
29
</ body >
21
30
</ html >
@@ -24,16 +33,12 @@ <h1 id="" class="text-center" style="margin: 100px;">
24
33
var app = angular . module ( 'demo' , [ 'lazyload' ] ) ;
25
34
app . controller ( 'demoCtro' , function ( $scope ) {
26
35
27
- $scope . title = 'lazyload-directive' ;
28
-
29
- $scope . watch = { } ;
30
- // 图片集合
31
- $scope . imgs = [ ] ;
36
+ $scope . title = 'ng-if && ng-show' ;
37
+ var vm = $scope . vm = { } ;
32
38
33
- var url = 600 ;
34
- for ( var i = 0 ; i < 20 ; i ++ ) {
35
- url ++ ;
36
- $scope . imgs . push ( 'http://placekitten.com/' + url + '/300' ) ;
39
+ vm . open = function ( ) {
40
+ vm . start = true ;
37
41
}
42
+
38
43
} )
39
44
</ script >
You can’t perform that action at this time.
0 commit comments