I start developing the MEAN stack and make a Todo application in which I create task tables and then save to todo in this specific task sheet using angularjs.
At first, I simply extracted all the todo without considering which list of tasks it belongs to, as well as creating todos on go. Now I want to improve it to get todos only for this particular task table. Since I dynamically want to load it, I use routeProvider with a value of '/:TaskID' where TaskID changes. Therefore, if TaskID exists, I use the function, otherwise I extract everything.
Something like that:
if($routeParams.TaskID) { var id = $routeParams.TaskID; Todos.getTodosForId(id) .success(function(data) { $scope.loading = false; $scope.formData = {};
Instead of using if-else, is it possible to keep them independent? How I want both of them to be useful by removing this condition. Is it possible to call the method here: For a specific TaskID:
.when('/:TaskID', { templateUrl: "app.html", controller: "mainController" })
For all Todos:
.when('/', { templateUrl: "app.html", controller: "mainController" })
Another question: how to show todos only for this particular task table when creating a task table?

As shown in the figure, on my page all todo are displayed, and not the one that has not yet been created. Therefore, instead of showing all Todo, he should first show me No Todos . As soon as I start adding todos, I should see only those todos in this task sheet. I'm a little confused about how to do this?
source share