0

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
1
  • Where is your template and which property do you want to display? Commented Mar 11, 2014 at 9:09

1 Answer 1

1

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}}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.