Hi Sander,

I take it back.  Your codes work.  But my codes also work.  The difference 
is I did not inject '$scope' in assignment controller.  And that's why this 
confuses me.  I know that if you need something, you have to inject it. 
 But why it still works if I did not inject $scope before I use it? 

app.controller('assignmentCtrl' 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; }); } 
); 

On Thursday, July 10, 2014 10:52:51 PM UTC-7, Sander Elias wrote:
>
> Hi Tan,
>
> While I did not run the example, I wonder why it would not work for you? 
> Did you get an error in the console?
> I always use the array notation, because I always minimize my code. I do 
> it by hand, but there are tools that can do the same.
> And yes, you are in fact injecting $scope. Unminimized my declaration, and 
> yours are exactly the same.
>
> Knowing when to inject something is easy. do you need/use it? inject!
> You already did that!
>
> 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.

Reply via email to