How to pass data to Mat-Menu from parent button? - angular-material

I'm building a component that displays menus by the following array
names = [{name:'John'}, {name:'Bill'}, {name:'Dan'}];
So i by iterating the array - will get 3 menus - like here :
What i need to be able to do is to display for each menu it's "name" , so instead of "My Name" - it should displays each of the names in the array (John, Bill, Dan)....
I know i could be done by using the [matMenuTriggerData] directive - but i can't understand how to implement it....
Example

Related

How to get Nested Dictionary Item in Umbraco?

I using Umbraco 7.4.3.
I created few dictionary items (rot item with few children items), like below:
HomePage
Intro
Body
When I try to get dictionary value for sub-item I getting empty string, however for root item I get correct result.
For example,
this call works - returns value according to current language:
#Umbraco.GetDictionaryValue("HomePage")
but this call doesn't work - returns empty string:
#Umbraco.GetDictionaryValue("HomePage.Intro")
Please help!
Make sure the child dictionary item has the full key specified: "HomePage.Intro"
Your tree should look like this:
HomePage
- HomePage.Intro
An example of the dictionary tree I'm currently using:

umbraco how to update multiple prevalue programatically

I have a member type which has a custom property - lets name it books - of data type checkbox - so multiple choice is possible.
Now I'm trying to update this member programatically with new values for books. In the customxml it comes as cdata, I'm passing a value as
umbraco.cms.businesslogic.member.Member member = umbraco.cms.businesslogic.member.Member.GetMemberFromEmail(email);
member.SetProperty("memberBooks", booksValue);
member.Save();
where 'booksValue' is a string of values seperated with comma - because it's how it appears in the contentXml.
It doesn't work.
The question is - how do I update the member property/ xml with new multiple values?
I have resolved this issue.
Both
member.getProperty(“memberBooks”).Value = booksValue;
and
member.SetProperty("memberBooks", booksValue);
work
I was just passing wrong values.
In the contentXml they display as values but actually I need to update the property with the ids so if the data type is checkbox list and the values are like:
1 - book
2 - booko
3 - booki
then in the contentXml it displays as a list "book,booko,booki" but to update it programatically I had to pass: "1,2,3" to the property.
So it should be:
member.SetProperty("memberBooks", "1,2,3");
instead of:
member.SetProperty("memberBooks", "book,booko,booki");
I hope it helps others with the same problem.
here is what you need to do:
umbraco.cms.businesslogic.member.Member member = umbraco.cms.businesslogic.member.Member.GetMemberFromEmail(email);
member.getProperty(“memberBooks”).Value = booksValue;
member.Save();
I hope this should work. I haven't tried it since long-time but this is how I used it.

Binding to specific part of a complex list

I have a complex list as a resource in the following form:-
sectionList
Sections
Section 0
Section 1
.
.
Section 12
Each of those have few properties like 'Name', ie. Section 0 have a property 'Name' and so on.
In my Xaml i have a ComboBox which i want to bind it's ItemsSource to get the Name property of each Section in this ComboBox. When i use ItemsSource="{Binding Path=Section}" i get only a list of the Types not the actual Name property. With that i mean the list looks like below:-
AppName.ClassName+Section (This is the Type)
AppName.ClassName+Section
.
.
.
AppName.ClassName+Section
So my question is, how to get the property Name instead of the Type in this ComboBox?
Hope this an enough discription otherwise i will be more than glad to explain more.
Use 'DisplayMemberName' on the combobox to pass in the name of the field you wish to display.
See WPF Combobox DisplayMemberPath for a usage example (use the solution, not the question as it is incorrect!)

Blackberry AutoCompleteField with first and last name

I'm trying to create an autocomplete field in a blackberry app that uses both the first name and the last name of a record to check for prefix matches. My BasicFilteredList is an array of record objects, each having a first name and a last name. I considered adding two instances of the same object array, with mapping String arrays of first and last names like so:
filterList.addDataSet(1, firstNames, recordsArray, "records2", BasicFilteredList.COMPARISON_IGNORE_CASE);
filterList.addDataSet(2, lastNames, recordsArray, "records2", BasicFilteredList.COMPARISON_IGNORE_CASE);
This however retrieves the same object twice. if the person's first and last name begin with the same user-entered prefix in the autocomplete field. In short, I am trying to mimic the existing blackberry contacts autocomplete functionality, but with my own custom records. Any help would be much appreciated. Thank you.

Get the display value from a DropDown

I'm trying to access the values in the FormCollection inside of an action. I can get the value field by doing:
var value = formCollection["MyDropDownList"];
But I can't seem to find a way to get the display value. Am I missing something obvious? A cast perhaps?
Getting text from an HTML drop down selection list using JavaScript code
To get the text from each option is slightly trickier. We use the selectedIndex property of the selection list to capture the selected option and then pass this value to the options[].text property.
Here is the code
var w = document.myform.mylist.selectedIndex;
var selected_text = document.myform.mylist.options[w].text;
I don't think there's a way to get the display column from the formcollection. Basically, the formcollection is an easy way to interrogate the Request object (Request.Form, Request.QueryString, etc.) and the only thing that goes into that are values from input fields.
If you really need to get the display text, you would have to get it from whatever collection you bound the list with and access it via the key (your selected value from the formcollection). For example, if it's a dictionary collection that you bound to the list, use that same dictionary to lookup the value based on the key.
I would need to know more information as to how you're binding the dropdown to help you further.
That's the normal behaviour. When a form is posted, only the name-value collection generated from the form fields are sent to the server. And of course the inner text of the option tag doesn't belong to that collection.
you do it ok, dropdown list sended shows value of selected item not displayed text of selected item...if you want(from some reason, because I am asumming you are filling that dropdown on model right? :)) to see send a display text also, maybe you can put it in hidden field with javascript on every change of selection in dropdown...
cheers

Resources