mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
Correct sorting
This commit is contained in:
@ -120,7 +120,7 @@
|
|||||||
<input type="text" ng-model="newTask.title" placeholder="Add an item...">
|
<input type="text" ng-model="newTask.title" placeholder="Add an item...">
|
||||||
</form>
|
</form>
|
||||||
<list>
|
<list>
|
||||||
<li class="list-item" ng-repeat="task in activeProject.tasks | reverse" ng-class="{completed: task.isCompleted}">
|
<li class="list-item" ng-repeat="task in activeProject.tasks" ng-class="{completed: task.isCompleted}">
|
||||||
{{task.title}}
|
{{task.title}}
|
||||||
</li>
|
</li>
|
||||||
</list>
|
</list>
|
||||||
@ -137,7 +137,7 @@
|
|||||||
<input type="text" ng-model="newProject.title" placeholder="Create a new list...">
|
<input type="text" ng-model="newProject.title" placeholder="Create a new list...">
|
||||||
</form>
|
</form>
|
||||||
<list>
|
<list>
|
||||||
<a ng-click="setActiveProject(project)" class="list-item list-item-primary" ng-class="{active: project.isActive}" ng-repeat="project in projects | reverse">
|
<a ng-click="setActiveProject(project)" class="list-item list-item-primary" ng-class="{active: project.isActive}" ng-repeat="project in projects">
|
||||||
{{project.title}}
|
{{project.title}}
|
||||||
</a>
|
</a>
|
||||||
</list>
|
</list>
|
||||||
|
|||||||
@ -99,7 +99,7 @@ angular.module('ionic.todo.controllers', ['ionic.todo'])
|
|||||||
|
|
||||||
// Set the priorty for this project to the new date, so it will
|
// Set the priorty for this project to the new date, so it will
|
||||||
// sort higher
|
// sort higher
|
||||||
$scope.activeProject.project.setPriority(+new Date);
|
$scope.activeProject.project.setPriority(-(+new Date));
|
||||||
|
|
||||||
$scope.newTask = {};
|
$scope.newTask = {};
|
||||||
};
|
};
|
||||||
@ -147,7 +147,7 @@ angular.module('ionic.todo.controllers', ['ionic.todo'])
|
|||||||
$scope.newProject = {};
|
$scope.newProject = {};
|
||||||
|
|
||||||
var np = $scope.projects.add(p);
|
var np = $scope.projects.add(p);
|
||||||
np.setPriority(+new Date);
|
np.setPriority(-(+new Date));
|
||||||
$scope.setActiveProject(np);
|
$scope.setActiveProject(np);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -162,12 +162,14 @@ angular.module('ionic.todo.controllers', ['ionic.todo'])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
projectsRef.once('child_added', function(snapshot) {
|
projectsRef.on('child_added', function(snapshot, prevChildName) {
|
||||||
$scope.setActiveProject(
|
if(prevChildName === null) {
|
||||||
angular.extend({
|
$scope.setActiveProject(
|
||||||
'$ref': snapshot.ref(),
|
angular.extend({
|
||||||
}, snapshot.val())
|
'$ref': snapshot.ref(),
|
||||||
)
|
}, snapshot.val())
|
||||||
|
)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user