Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
This function bind hole catagory but i wont to bind a single catagory subcatagory.

<!-- ko foreach: {data: ParentCatagories ,as :'parent'} -->


<img data-bind="attr:{alt: parent.CategoryName, src: parent.CategoryImage}" />


<!-- ko foreach: {data: $parent.getsubCatagories(parent.CategoryId) ,as: 'child' } -->



<!-- /ko -->







self.cols = ko.observableArray();
self.getsubCatagories = function (obj) {

$.ajax({
url: '/api/Catagory',
cache: false,
type: 'GET',
contentType: 'application/json; charset=utf-8',
data: { CatId: obj },
success: function (data) {
alert(data.length);
$.each(data, function (key, value) {
Catagory.CategoryName = value.CategoryName;
Catagory.parentId = value.parentId;
Catagory.PostCount = value.PostCount;
Catagory.CategoryImage = value.CategoryImage;
Catagory.CategoryChangeSource = "City";
Catagory.CategoryId = value.CategoryId;
self.cols.push(value);

});
}
});
return self.cols;
};
Posted
Updated 14-Oct-14 6:23am
v2
Comments
Rajib Mahata 15-Oct-14 2:44am    
I solve it .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900