Hi Sander,
Thank you for the sample codes. However, it does not work "as is". I have
to modify it for it to work:
app.controller('assignmentCtrl', function($scope){....}
As you can see, I do not inject $scope at the controller level. I am not
knowledgeable enough to even tell when $scope needs to be injected.
Tan
On Wednesday, July 9, 2014 9:47:38 PM UTC-7, Sander Elias wrote:
>
> Hi Tan,
>
> That is what I meant that you needed an extra controller! You don’t even
> need the ng-Init anymore now.
> change your controller a bit so it looks like this:
>
> app.controller('assignmentCtrl', [
> '$scope',
> function($scope) {
> //set up the empty array, so angular start with binding an empty
> array!
> $scope.assignments = [];
> // you can use the $scope variables from the parent scope in here!
> $http.get('something.php?emp=' + $scope.employee + '&d=' + $scope.day)
> .then(function(response) {
> $scope.assignments = response.data;
> });
> }
> ]);
>
> and your HTML:
>
> <td class="calendar-unit" ng-repeat="day in days"
> ng-controller='assignmentCtrl'>
> {{day.date()}}
> <div class="assignment" ng-repeat="assignment in assignments">
> {{assignment.type}}
> </div>
> </td>
>
> Regards
> Sander
>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.