I am stuck on the functionality to show user hints while searching of products in application.I do have an Api which returns me all category-Listing with its sub-categories/child.I have save it in my local storage but i am really confused that how can i make loop to display characters in hint list just below the search bar while user is typing something in search bar.I know the process but do not know how to implement in all nested child for every category.
I have found this below mentioned example but again its working for only simple Array ..
Example :- http://codepen.io/calendee/pen/pCwyx
Can any one suggest me that how can i use the above logic for my array
[
{
id: "165",
title: "Women's Fashion",
url: "womens-fashion",
children: [
{
id: "176",
title: "Women's Aparel",
url: "women-s-aparel",
children: [
{
id: "221",
title: "Formal",
url: "formal"
},
{
id: "222",
title: "Casual",
url: "casual"
},
{
id: "223",
title: "Traditional",
url: "traditional"
},
{
id: "224",
title: "Nightwears",
url: "nightwears"
},
{
id: "225",
title: "Winter wears",
url: "winter-wears"
},
{
id: "240",
title: "Party Wear",
url: "party-wear"
}
]
},
{
id: "220",
title: "Western Wear",
url: "western-wear",
children: [
{
id: "318",
title: "Glam & Luxe Style Wears",
url: "glam-luxe-style-wears"
},
{
id: "412",
title: "Dresses",
url: "dresses"
},
{
id: "413",
title: "Tops & Tees",
url: "tops-tees"
},
{
id: "414",
title: "Bottom Wear",
url: "bottom-wear"
}
]
},
{
id: "305",
title: "Ethnic Wear",
url: "ethnic-wear",
children: [
{
id: "407",
title: "Sarees",
url: "sarees"
},
{
id: "408",
title: "Lehnga Choli",
url: "lehnga-choli"
},
{
id: "409",
title: "Gown",
url: "gown"
},
{
id: "410",
title: "Salwar Kameez & Churidar",
url: "salwar-kameez-churidar"
},
{
id: "411",
title: "Kurtis",
url: "kurtis"
}
]
},
{
id: "306",
title: "Jewellery",
url: "jewellery",
children: [
{
id: "307",
title: "Anklets",
url: "anklets"
},
{
id: "308",
title: "Bridal Set",
url: "bridal-set"
},
{
id: "309",
title: "Mala",
url: "mala"
},
{
id: "310",
title: "Mangalsutra",
url: "mangalsutra"
},
{
id: "311",
title: "Necklace Set",
url: "necklace-set"
},
{
id: "312",
title: "Ring",
url: "ring"
},
{
id: "316",
title: "Bangles",
url: "bangles"
},
{
id: "317",
title: "Earings",
url: "earings"
}
]
},
{
id: "415",
title: "Leggings & Jeggings",
url: "leggings-and-jeggings"
},
{
id: "416",
title: "Lingeries & Nightwears",
url: "lingeries-and-nightwears"
},
{
id: "417",
title: "All Women Clothing",
url: "all-women-clothing"
}
]
},
{
id: "404",
title: "Men's Fashion",
url: "mens-fashion",
children: [
{
id: "177",
title: "Men's Aparel",
url: "men-s-aparel",
children: [
{
id: "226",
title: "Casual",
url: "casual"
},
{
id: "227",
title: "Formal",
url: "formal"
},
{
id: "230",
title: "Others",
url: "others"
},
{
id: "303",
title: "Winter",
url: "winter"
},
{
id: "239",
title: "Party Wear",
url: "party-wear"
}
]
},
{
id: "229",
title: "Ethnic",
url: "ethnic",
children: [
{
id: "418",
title: "Indo Western",
url: "indo-western"
},
{
id: "419",
title: "Kurta Pyjama",
url: "kurta-pyjama"
},
{
id: "420",
title: "Kurta",
url: "kurta"
},
{
id: "421",
title: "Sherwanis",
url: "sherwanis"
}
]
},
{
id: "228",
title: "Western",
url: "western",
children: [
{
id: "422",
title: "Jeans",
url: "jeans"
},
{
id: "423",
title: "Polo & Tees",
url: "polo-tees"
},
{
id: "424",
title: "Shirts",
url: "shirts"
},
{
id: "425",
title: "Trousers",
url: "trousers"
},
{
id: "426",
title: "Shorts & 3/4",
url: "shorts-and-3-4"
}
]
},
{
id: "427",
title: "Inner wear",
url: "inner-wear"
},
{
id: "428",
title: "Sleep & Lounge Wear",
url: "sleep-and-lounge-wear"
},
{
id: "429",
title: "Knit Wear",
url: "knit-wear"
},
{
id: "430",
title: "Suits & Blazers",
url: "suits-and-blazers"
},
{
id: "431",
title: "Sweat Shirts",
url: "sweat-shirts"
}
]
}
]
Related
I have this json in MongoDB:
{
_id: ObjectId("630fbb09cc9deb16a33fbcde"),
firmness: {
name: 'hard',
url: 'https://pokeapi.co/api/v2/berry-firmness/3/'
},
flavors: [
{
flavor: {
name: 'spicy',
url: 'https://pokeapi.co/api/v2/berry-flavor/1/'
},
potency: 10
},
{
flavor: {
name: 'dry',
url: 'https://pokeapi.co/api/v2/berry-flavor/2/'
},
potency: 0
},
{
flavor: {
name: 'sweet',
url: 'https://pokeapi.co/api/v2/berry-flavor/3/'
},
potency: 0
},
{
flavor: {
name: 'bitter',
url: 'https://pokeapi.co/api/v2/berry-flavor/4/'
},
potency: 0
},
{
flavor: {
name: 'sour',
url: 'https://pokeapi.co/api/v2/berry-flavor/5/'
},
potency: 10
}
],
growth_time: 2,
id: 20,
item: { name: 'pinap-berry', url: 'https://pokeapi.co/api/v2/item/145/' },
max_harvest: 10,
name: 'pinap',
natural_gift_power: 70,
natural_gift_type: { name: 'grass', url: 'https://pokeapi.co/api/v2/type/12/' },
size: 80,
smoothness: 20,
soil_dryness: 35
}
And I want to get the soil_dryness field and the field called "name" into flavor list from 'flavors' array.
How can I do that?
I tried with:
db.Berries.find({},{soil_dryness:1},{"flavors.$":1}).pretty().limit(20)
But unfortunately doesn't works.
Query
project, the soil_dryness and the names, path in arrays = array with the values, here the names
*not sure if this the output you need, if its not if you can add the expected ouput you need
Playmongo
db.Berries.aggregate(
[{"$project": {"soil_dryness": 1, "names": "$flavors.flavor.name"}},
{"$limit": 20}])
export const imageTag = [
{
link:
"https://images.pexels.com/photos/70069/pexels-photo-70069.jpeg?cs=srgb&dl=pexels-daniyal-ghanavati-70069.jpg&fm=jpg",
id: 1,
title: "Bird image",
tags: ["nature", "bird"]
},
{
link:
"https://media.istockphoto.com/photos/renewable-energy-and-sustainable-development-picture-id1186330948?k=20&m=1186330948&s=612x612&w=0&h=5aNPCcQ8FcZraX44PEhb2mqcHkow2xMITJMHdh28xNg=",
id: 2,
title: "nature 1",
tags: ["nature"]
},
{
link:
"https://images.unsplash.com/photo-1538941214074-9b578e573632?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxleHBsb3JlLWZlZWR8Nnx8fGVufDB8fHx8&w=1000&q=80",
id: 3,
title: "river image",
tags: ["nature", "river"]
},
{
link:
"https://images.pexels.com/photos/459198/pexels-photo-459198.jpeg?cs=srgb&dl=pexels-pixabay-459198.jpg&fm=jpg",
id: 4,
title: "image river-nature",
tags: ["nature", "river"]
},
{
link:
"https://images.pexels.com/photos/1001682/pexels-photo-1001682.jpeg?cs=srgb&dl=pexels-kellie-churchman-1001682.jpg&fm=jpg",
id: 5,
title: "image12",
tags: ["sea"]
},
{
link:
"https://upload.wikimedia.org/wikipedia/commons/thumb/7/7d/Wildlife_at_Maasai_Mara_%28Lion%29.jpg/800px-Wildlife_at_Maasai_Mara_%28Lion%29.jpg",
id: 6,
title: "Animal 1",
tags: ["animal"]
},
{
link:
"https://res.cloudinary.com/dk-find-out/image/upload/q_80,w_1920,f_auto/Animal_kingdom_nzwbda.jpg",
id: 7,
title: "Animal 2",
tags: ["animal"]
},
{
link:
"https://image.shutterstock.com/image-photo/side-view-lion-walking-panthera-260nw-165448391.jpg",
id: 8,
title: "lion 2",
tags: ["lion"]
},
{
link:
"https://images.pexels.com/photos/1172253/pexels-photo-1172253.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500",
id: 9,
title: "lifestyle image",
tags: ["lifestyle", "river"]
},
{
link:
"https://cdn.pixabay.com/photo/2017/08/30/01/05/milky-way-2695569__480.jpg",
id: 10,
title: "galaxy 1",
tags: ["galaxy"]
},
{
link:
"https://images.unsplash.com/photo-1453728013993-6d66e9c9123a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8bGVuc3xlbnwwfHwwfHw%3D&w=1000&q=80",
id: 11,
title: "Lens",
tags: ["lens"]
},
{
link:
"https://cdn.pixabay.com/photo/2015/04/19/08/32/marguerite-729510__480.jpg",
id: 12,
title: "image flower",
tags: ["nature", "flower"]
}
];
here is one approach.
const data = [{ link: "https://images.pexels.com/photos/70069/pexels-photo-70069.jpeg?cs=srgb&dl=pexels-daniyal-ghanavati-70069.jpg&fm=jpg", id: 1, title: "Bird image", tags: ["nature", "bird"] }, { link: "https://media.istockphoto.com/photos/renewable-energy-and-sustainable-development-picture-id1186330948?k=20&m=1186330948&s=612x612&w=0&h=5aNPCcQ8FcZraX44PEhb2mqcHkow2xMITJMHdh28xNg=", id: 2, title: "nature 1", tags: ["nature"] }, { link: "https://images.unsplash.com/photo-1538941214074-9b578e573632?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxleHBsb3JlLWZlZWR8Nnx8fGVufDB8fHx8&w=1000&q=80", id: 3, title: "river image", tags: ["nature", "river"] }, { link: "https://images.pexels.com/photos/459198/pexels-photo-459198.jpeg?cs=srgb&dl=pexels-pixabay-459198.jpg&fm=jpg", id: 4, title: "image river-nature", tags: ["nature", "river"] }, { link: "https://images.pexels.com/photos/1001682/pexels-photo-1001682.jpeg?cs=srgb&dl=pexels-kellie-churchman-1001682.jpg&fm=jpg", id: 5, title: "image12", tags: ["sea"] }, { link: "https://upload.wikimedia.org/wikipedia/commons/thumb/7/7d/Wildlife_at_Maasai_Mara_%28Lion%29.jpg/800px-Wildlife_at_Maasai_Mara_%28Lion%29.jpg", id: 6, title: "Animal 1", tags: ["animal"] }, { link: "https://res.cloudinary.com/dk-find-out/image/upload/q_80,w_1920,f_auto/Animal_kingdom_nzwbda.jpg", id: 7, title: "Animal 2", tags: ["animal"] }, { link: "https://image.shutterstock.com/image-photo/side-view-lion-walking-panthera-260nw-165448391.jpg", id: 8, title: "lion 2", tags: ["lion"] }, { link: "https://images.pexels.com/photos/1172253/pexels-photo-1172253.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500", id: 9, title: "lifestyle image", tags: ["lifestyle", "river"] }, { link: "https://cdn.pixabay.com/photo/2017/08/30/01/05/milky-way-2695569__480.jpg", id: 10, title: "galaxy 1", tags: ["galaxy"] }, { link: "https://images.unsplash.com/photo-1453728013993-6d66e9c9123a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8bGVuc3xlbnwwfHwwfHw%3D&w=1000&q=80", id: 11, title: "Lens", tags: ["lens"] }, { link: "https://cdn.pixabay.com/photo/2015/04/19/08/32/marguerite-729510__480.jpg", id: 12, title: "image flower", tags: ["nature", "flower"] } ]
const allTags = []
data.forEach(item => {
const {tags} = item
allTags.push(...tags)
})
const filtered = [...new Set(allTags)].sort()
console.log(filtered)
I have the below code to render events to Jquery Full calendar..
the code returns the events as object but i don't know how to render the events..Pease help me to sort out...
<script>
$(document).ready(function(){
var pageUrl = '<%=ResolveUrl("~/xtest.aspx")%>';
$('#calendar').fullCalendar({
theme: true,
color: 'red',
header: { left: 'prev,next', center: 'today,title', right: 'agendaDay,agendaWeek,month' },
events: function(start, end, timezone, callback) {
$.ajax({
type: 'POST',
url: pageUrl+"/GetEvents",
data: '{Start: "' + start + '",End: "' + end + '"}',
contentType: "application/json; charset=utf-8",
dataType: 'json',
success: function(response){
callback(response.d);
}
});
}
});
});
<script>
/GetEvents returns like below..
[
{
title: 'All Day Event',
start: '2014-09-01'
},
{
title: 'Long Event',
start: '2014-09-07',
end: '2014-09-10'
},
{
id: 999,
title: 'Repeating Event',
start: '2014-09-09T16:00:00'
},
{
id: 999,
title: 'Repeating Event',
start: '2014-09-16T16:00:00'
},
{
title: 'Conference',
start: '2014-09-11',
end: '2014-09-13'
},
{
title: 'Meeting',
start: '2014-09-12T10:30:00',
end: '2014-09-12T12:30:00'
},
{
title: 'Lunch',
start: '2014-09-12T12:00:00'
},
{
title: 'Meeting',
start: '2014-09-12T14:30:00'
},
{
title: 'Happy Hour',
start: '2014-09-12T17:30:00'
},
{
title: 'Dinner',
start: '2014-09-12T20:00:00'
},
{
title: 'Birthday Party',
start: '2014-09-13T07:00:00'
},
{
title: 'Click for Google',
url: 'http://google.com/',
start: '2014-09-28'
}
]
I am using KendoUI scheduler with AngularJS.
I am declaring the scheduler options in accordance with the documentation, pretty standard stuff. See below:
What I would like to do is be able to update $scope.schedulerOptions and have those changes reflected in the UI. When I make changes to $scope.schedulerOptions nothing changes in the UI.
Any ideas on how to do this?
$scope.schedulerOptions = {
date: new Date("2013/6/13"),
startTime: new Date("2013/6/13 07:00 AM"),
height: 600,
views: [
"day",
{ type: "workWeek", selected: true },
"week",
"month",
],
eventTemplate: "<span class='custom-event'>{{dataItem.title}}</span>",
allDayEventTemplate: "<div class='custom-all-day-event'>{{dataItem.title}}</div>",
timezone: "Etc/UTC",
dataSource: {
batch: true,
transport: {
read: {
url: "http://demos.telerik.com/kendo-ui/service/tasks",
dataType: "jsonp"
},
update: {
url: "http://demos.telerik.com/kendo-ui/service/tasks/update",
type: "PUT"
},
create: {
url: "http://demos.telerik.com/kendo-ui/service/tasks/create",
type: "POST"
},
destroy: {
url: "http://demos.telerik.com/kendo-ui/service/tasks/destroy",
type: "DELETE"
},
parameterMap: function(options, operation) {
if (operation !== "read" && options.models) {
return {models: kendo.stringify(options.models)};
}
}
},
schema: {
model: {
id: "taskId",
fields: {
taskId: { from: "TaskID", type: "number" },
title: { from: "Title", defaultValue: "No title", validation: { required: true } },
start: { type: "date", from: "Start" },
end: { type: "date", from: "End" },
startTimezone: { from: "StartTimezone" },
endTimezone: { from: "EndTimezone" },
description: { from: "Description" },
recurrenceId: { from: "RecurrenceID" },
recurrenceRule: { from: "RecurrenceRule" },
recurrenceException: { from: "RecurrenceException" },
ownerId: { from: "OwnerID", defaultValue: 1 },
isAllDay: { type: "boolean", from: "IsAllDay" }
}
}
},
filter: {
logic: "or",
filters: [
{ field: "ownerId", operator: "eq", value: 1 },
{ field: "ownerId", operator: "eq", value: 2 }
]
}
},
resources: [
{
field: "ownerId",
title: "Owner",
dataSource: [
{ text: "Alex", value: 1, color: "#f8a398" },
{ text: "Bob", value: 2, color: "#51a0ed" },
{ text: "Charlie", value: 3, color: "#56ca85" }
]
}
]
};
According to this post at telerik forum you can change the values after initialization modifying HTML to <div kendo-scheduler="sched" k-options="options"></div> and the accessing sched as a model variable $scope.sched.setOptions(...);
I am new to AngularJs, and I'm creating the nested view template like this:
http://plnkr.co/edit/u18KQc?p=preview
But the code I have is of different type. For routing, it uses this:
awfApp.config(function ($stateProvider, $urlRouterProvider) {
var states = [
{ name: 'home', isDefault: true }, //TODO: Moure a awf
{ name: 'module1', module: { title: "Module 01", img: "modul1.png" } },
{ name: 'module2', module: { title: "Module 02", img: "modul2.png" } },
{ name: 'mainlist4', module: { title: "Main List4", img: "modul2.png" } },
{ name: 'mainlist2', module: { title: "Main List2", img: "modul2.png" } },
{ name: 'mainlist', module: { title: "Main List", img: "modul2.png" } }
];
if (appConfig.doLogin)
states.push({ name: 'articles', module: { title: "Articles", img: "articles.png" } });
});
Please tell me, how can create nested views in AngularJs using the code above.
Thanks