user3305175
user3305175

Reputation: 55

how to display data from console angularjs

I have a controller where i retrieve data by id from my state . How can i display those console data in my template?

app.controller('DetailCtrl', function($scope, $http, Inventory, Tags, User, $location, sharedService, inventoryItem) {  
console.log(inventoryItem);
};

Here is my state

.state('inventory.description',{
url:'/inventory/description/:id',
    views: {
        "descriptionview": {
            templateUrl: 'inventory/description.tpl.html',
            controller: 'DetailCtrl'
        }
    },
    data:{ pageTitle: 'DescriptionView'},
    resolve: {
        inventoryItem: function($stateParams, Inventory){
            return  Inventory.query({id: $stateParams.id});
    }
}
})

console retrieves data

Resource {$promise: Object, $resolved: false, $get: function, $save: function, $query:        function…}
$promise: Object
$resolved: true
barcode: "11234"
count: 22
cover: "/media/http%3A/api.bos.lv/media/static/images/no-image_1.png"
created: "2014-03-07T11:07:18.184465"
description: "LG monitor description"
id: 2

Upvotes: 0

Views: 626

Answers (1)

user3401164
user3401164

Reputation: 21

You can do something like this I think:

in your controller you can assign:

$scope.toDisplay = inventoryItem;

and in your template, add this where you want to display it:

{{toDisplay.barcode}}

Upvotes: 1

Related Questions