1+ <!doctype html>
2+ < html ng-app ="application ">
3+ < head >
4+ < meta charset ="utf-8 ">
5+ < title > Scroller Demo (controller as)</ title >
6+ < script src ="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.js "> </ script >
7+ < script src ="../../dist/ui-scroll.js "> </ script >
8+ < script src ="../../dist/ui-scroll-jqlite.js "> </ script >
9+ < script src ="controllerAs.js "> </ script >
10+ < link rel ="stylesheet " href ="../css/style.css " type ="text/css "/>
11+
12+
13+ </ head >
14+ < body ng-app ="application ">
15+
16+ < div class ="cont cont-global " ng-controller ="mainController as mainCtrl " ng-init ="show = true ">
17+ < a class ="back " href ="../index.html "> browse other examples</ a >
18+ < h1 class ="page-header page-header-exapmle "> Controller as syntax for the Datasource and the Adapter</ h1 >
19+ < div class ="description ">
20+ If you have defined your controller in such way
21+ < div class ="code ">
22+ < pre > <div ng-controller="mainController as mainCtrl"></ pre >
23+ </ div >
24+ then you just shouldn't miss it when you define your datasource or adapter:
25+ < div class ="code ">
26+ < pre > <div ui-scroll="item in mainCtrl.datasource" adapter="mainCtrl.adapter">{{item}<!----> }</div></ pre >
27+ </ div >
28+ "Hide/Show" button provides a nested scope between mainController and the Viewport via ng-if directive.
29+ </ div >
30+
31+ < div class ="actions ">
32+ < button ng-click ="show = !show "> {{!show ? 'Show' : 'Hide'}}</ button >
33+ < button ng-click ="mainCtrl.updateList() "> Update</ button >
34+ </ div >
35+
36+ < div class ="info ">
37+ < span ng-hide ="mainCtrl.adapter.isLoading "> data has been loaded</ span >
38+ < span ng-hide ="!mainCtrl.adapter.isLoading "> data loading...</ span >
39+ </ div >
40+
41+ < div ng-if ="show ">
42+ < div ui-scroll-viewport class ="viewport viewport-height-fixed " id ="viewport-adapter1 ">
43+ < div class ="item " ui-scroll ="item in mainCtrl.datasource "
44+ adapter ="mainCtrl.adapter "
45+ buffer-size ='5 '> {{item.content}}</ div >
46+ </ div >
47+ </ div >
48+ </ div >
49+
50+ </ body >
51+ </ html >
0 commit comments