With Umbraco v7 the findIndex method worked properly.
With Umbraco v8 instead I receive this error:
TypeError: vm.JSONStructure.findIndex is not a function
at AFAPPJSONConfig.vm.AddNewDocType (afapp.controller.js?cdv=1:61)
at fn (eval at compile (angular.js?cdv=1:16486), <anonymous>:4:409)
at callback (angular.js?cdv=1:29019)
at Scope.$eval (angular.js?cdv=1:19461)
at Scope.$apply (angular.js?cdv=1:19560)
at HTMLAnchorElement.<anonymous> (angular.js?cdv=1:29023)
at HTMLAnchorElement.dispatch (jquery.min.js?cdv=1:2)
at HTMLAnchorElement.v.handle (jquery.min.js?cdv=1:2)
-----------------------------------------------------------
Where line 61 is the following line of my code:
vm.sectionPosition = vm.JSONStructure.findIndex(s => s.sectionName === sectionAlias);
What's changed from Umbraco v7 to v8 and how can I solve the problem?
is usually an indication that the object isn't an array...
I'm not sure what your Json Structure would have been in V7, but in the snippet you've posted, wouldn't it be the "tabs" property you'd need to be using findIndex on?
it's those elements within "tabs" that seem to be an array which have the 'sectionName' to filter by?
Umbraco v8 - Angular - findIndex is not a function
Hi, I'm trying to update a my custom package from umbraco v7 to v8
In my controller I have the variable vm.JSONStructure with this content:
In my controller I also have this function that add a new doctype in the vm.JSONStructure variable:
With Umbraco v7 the findIndex method worked properly.
With Umbraco v8 instead I receive this error:
What's changed from Umbraco v7 to v8 and how can I solve the problem?
Thanks for the support Adriano
Hmmm Adriano hmmm
findIndex is not a function
is usually an indication that the object isn't an array...
I'm not sure what your Json Structure would have been in V7, but in the snippet you've posted, wouldn't it be the "tabs" property you'd need to be using findIndex on?
it's those elements within "tabs" that seem to be an array which have the 'sectionName' to filter by?
regards
Marc
Hi Marc, damn...you are right!!! :-)
I forgot that for the new version I have slightly modified the original json structure (I'm very embarrassed)
ok...my mistake!!!
Thanks
A.
is working on a reply...