5

This code is not working:

<td><img src="{{$rootScope.s3BucketUrl}}"/></td>

and this is where it's defined:

var appCtrl = app.controller('AppCtrl', function($scope, $resource, $location, $route, sharedProperties, $q, $rootScope){
    defer = $q.defer();
    //$rootScope.s3BucketUrl = 'http://lynd.s3.amazonaws.com/';//comment below one when live
    $rootScope.s3BucketUrl = 'http://lynd-test.s3.amazonaws.com/';
//code omitted
});

AppCtrl is bound first on body tag.

Could anybody please suggest how do I print $rootScope variable?

1 Answer 1

10

Just use {{s3BucketUrl}} and you would get the value.

Your current scope is a child scope of rootscope and hence you can always access the elements of rootscope.

This wiki is highly recommended

Sign up to request clarification or add additional context in comments.

2 Comments

How do I access $rootScope's variable x if I have a variable named x in child scope too?
Inject $rootScope into the controller and directly acess it $rootScope.x

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.