According to your description, you want to distinct the destination building’s value by destinationBuildingId and then push them into destinationBuildingIdList.
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
If you have any other questions, please feel free to contact me any time.
Best Regards,
Dillion
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Your above solution fetching the object (full row) based on distinct value of specified column.
but i need to fetch the distinct value for particular column alone i.e. distinctBuildingId list. Following is the solution for get the distinct value for particular column,
$scope.destinationBuildingIdList1=_.uniq(_.map($scope.items, 'destinationBuildingId'))// it fetch only distict value of destinationBuildingId column
Member
79 Points
109 Posts
How to get the distinct value from scope variable in controller using Angular JS ?
May 11, 2017 01:24 PM|kaviyarasan|LINK
How to fetch the distinct building ID list alone from $scope.items and store into $scope.destinationBuildingIdList variable?
All-Star
45489 Points
7008 Posts
Microsoft
Re: How to get the distinct value from scope variable in controller using Angular JS ?
May 12, 2017 07:09 AM|Zhi Lv - MSFT|LINK
Hi Kaviyarasan,
According to your description, you want to distinct the destination building’s value by destinationBuildingId and then push them into destinationBuildingIdList.
I wrote an example, perhaps it can help you.
Then, the result as below:
Best regards,
Dillion
Member
79 Points
109 Posts
Re: How to get the distinct value from scope variable in controller using Angular JS ?
May 12, 2017 12:44 PM|kaviyarasan|LINK
Hi Zhi Lv - MSF...
Thanks for your solution.
The following solution also working fine,
But when we using map function, sometime getting $injector:modulerr Error in IE browser only. why? How to solve this?
Thanks,
Kavin.S
All-Star
45489 Points
7008 Posts
Microsoft
Re: How to get the distinct value from scope variable in controller using Angular JS ?
May 15, 2017 02:48 AM|Zhi Lv - MSFT|LINK
Hi Kavin.S,
As far as I know, the angular js doesn't support IE8 or earlier after v1.2 .
You could check the following link for more details information:
https://docs.angularjs.org/guide/ie
If you have any other questions, please feel free to contact me any time.
Best Regards,
Dillion
Participant
1380 Points
608 Posts
Re: How to get the distinct value from scope variable in controller using Angular JS ?
May 15, 2017 06:01 PM|JBetancourt|LINK
Using lodash you can just do
Please remember to click "Mark as Answer" the responsES that resolved your issue.
Participant
1380 Points
608 Posts
Re: How to get the distinct value from scope variable in controller using Angular JS ?
May 17, 2017 02:21 AM|JBetancourt|LINK
Please remember to click "Mark as Answer" the responses that resolved your issue.
Please remember to click "Mark as Answer" the responsES that resolved your issue.
Member
79 Points
109 Posts
Re: How to get the distinct value from scope variable in controller using Angular JS ?
May 23, 2017 07:16 AM|kaviyarasan|LINK
Hi JBetancourt,
Thanks for your reply.
Your above solution fetching the object (full row) based on distinct value of specified column.
but i need to fetch the distinct value for particular column alone i.e. distinctBuildingId list. Following is the solution for get the distinct value for particular column,
Thanks,
Kavin.S