Skip to content

getLocalizedString filter returns an array! #38

@abods

Description

@abods

Fixing getLocalizedString filter to select the first matched object because it returns an array!

getLocalizedString: function(KEY) {
// default the result to an empty string
var result = '';

// make sure the dictionary has valid data
if (localize.resourceFileLoaded) {
    // use the filter service to only return those entries which match the KEY
    // and only take the first result
    var entry = $filter('filter')(localize.dictionary, function(element) {
            return element.key === KEY;
        }
    )[0]; // get the first matched
    // set the result
    result = entry.value;
}
// return the value to the call
return result;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions