Skip to content

Commit

Permalink
replaced previous binding workaround by yet another workaround ;-) (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
cburgdorf committed May 8, 2012
1 parent c814275 commit 4d39a66
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions app/js/controllers.js
Expand Up @@ -4,11 +4,13 @@
App.controller('StreamController',['$scope','scrollService', 'githubService' ,function ($scope, scrollService, githubService) {

var currentPage = 1;
$scope.username = "";

//https://github.com/angular/angular.js/issues/943
$scope.username = {value: ""};

scrollService.observe('EndReached').subscribe(function(){
currentPage++;
githubService.fetchEventStream($scope.username, currentPage)
githubService.fetchEventStream($scope.username.value, currentPage)
.subscribe(function(data){
$scope.$apply(function(){
angular.forEach(data, function(value){
Expand All @@ -22,11 +24,9 @@ App.controller('StreamController',['$scope','scrollService', 'githubService' ,fu

$scope.stream = [];

//TODO figure out why the binding doesn't work in the traditional way
$scope.refreshData = function(username){
$scope.username = username;
$scope.refreshData = function(){
githubService
.fetchEventStream(username, 1)
.fetchEventStream($scope.username.value, 1)
.subscribe(function(data){
if (!resetDataIfInvalid(data)){
$scope.$apply(function(){
Expand Down
6 changes: 3 additions & 3 deletions app/partials/filterbox.html
@@ -1,9 +1,9 @@
<div class="filter-bar">
<div class="settings">
<!--TODO ask in angular group why we can't bind the username the regular way-->
<!--HACK https://github.com/angular/angular.js/issues/943-->
<div class="username">
<form ng-submit="refreshData(username)">
<input ng-change="refreshData(username)" placeholder="Enter any github user name" type="text" ng-model="username">
<form ng-submit="refreshData()">
<input ng-change="refreshData()" placeholder="Enter any github user name" type="text" ng-model="username.value">
</form>
</div>

Expand Down

0 comments on commit 4d39a66

Please sign in to comment.