Create angular directive to search for a few types of entities and display the results in a drop-down list. The directive must be highly reusable
$10-30 USD
Cancelled
Posted over 8 years ago
$10-30 USD
Paid on delivery
Problem description:
Develop an angular directive to search for a few types of entities (manufacturers, industries and cars) as you type, and display the results in a drop-down list. The directive must be highly reusable, which means that it can be plugged in any kind of searchable entity context, like a manufacturer's profile page to search its cars, on an application's main header to globally search for entities etc. The directive should accept an attribute with the type of the entity the user can search for in the current context.
As the directive can search for a few entity types, it should be able to get the data from different providers, dependent on the provided entity type.
The directive can have it's own complete template, or it can be an attribute directive that can be associated with an input field - the drop down results can in that case be implemented either by the directive itself or by the template the directive is included in. Also, depending on the directive implementation, it can provide the results to the parent context in different ways (by exposing them on the scope, by emitting events, etc.).
Hints:
- the directive can be element or attribute based
- you can mock the entities data in the providers which would usually fetch them from a server
- it's enough to implement one entity context where the search directive will be used (for example, industry page from where you'd use the directive to search for it's manufacturers)
- design the directive as scalable as possible regarding the amount of entity types it can search for (3 are in the example, but why not be able to add an additional 10 or more) - because of that, heavy usage of ifs and switches are discouraged