File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4747 </ fieldset >
4848 < button type ="button " class ="btn btn-default " ng-click ="fixSize() "> Fix size</ button >
4949 < button type ="button " class ="btn btn-default " ng-click ="changeData() "> Change Data</ button >
50+ < button type ="button " class ="btn btn-default " ng-click ="insert() "> Insert</ button >
5051 </ form >
5152 </ div >
5253
9697 } ;
9798
9899 $scope . parentScopeValue = 'Outer scope' ;
100+
101+ $scope . insert = function ( ) {
102+ $scope . data . splice ( 0 , 0 , {
103+ id : $scope . data . length ,
104+ name : "Some Test Name " + $scope . data . length
105+ } ) ;
106+ } ;
107+
108+ $scope . remove = function ( item ) {
109+ $scope . data . splice ( $scope . data . indexOf ( item ) , 1 ) ;
110+ } ;
99111 } ] ) ;
100112 </ script >
101113 < script type ="text/ng-template " id ="SimpleCell ">
102114 < div class = "item-cell-padding" >
103115 < div class = "item-cell" >
104116 < p > { { item . name } } </ p >
105- < p > { { parentScopeValue } } </ p >
117+ < div >
118+ < button class = "btn btn-default" ng-click = "remove(item)" > Remove</ button >
119+ </ div >
106120 </ div >
107121 </ div >
108122 </ script >
Original file line number Diff line number Diff line change 100100 } ) ;
101101 layout ( ) ;
102102 } ) ;
103- scope . $watch ( 'items' , function ( ) {
103+ scope . $watchCollection ( 'items' , function ( ) {
104104 lastScrollPosition = Number . NEGATIVE_INFINITY ;
105105 layout ( ) ;
106106 } ) ;
Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ declare const angular: any;
109109 } ) ;
110110 layout ( ) ;
111111 } ) ;
112- scope . $watch ( 'items' , ( ) => {
112+ scope . $watchCollection ( 'items' , ( ) => {
113113 lastScrollPosition = Number . NEGATIVE_INFINITY ;
114114 layout ( ) ;
115115 } ) ;
You can’t perform that action at this time.
0 commit comments