admin管理员组

文章数量:1288075

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 = '/';//ment below one when live
    $rootScope.s3BucketUrl = '/';
//code omitted
});

AppCtrl is bound first on body tag.

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

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./';//ment below one when live
    $rootScope.s3BucketUrl = 'http://lynd-test.s3.amazonaws./';
//code omitted
});

AppCtrl is bound first on body tag.

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

Share Improve this question asked Jul 20, 2013 at 6:42 JackJack 7,55722 gold badges66 silver badges107 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 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 remended

本文标签: javascriptHow do I print rootScope variableStack Overflow