Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Proposal: Replace ui-router-specific implementation w/ generic implementation #11233

Open
@jeme

Description

@jeme

Proposal:

Currently Angularjs Material has code that is tightly coupled to UI-Router, while the code in it self isn't really harmful, it provides the question, what about the next router, what about the next custom link directive etc...

This simply isn't generic...

Instead, provide a way to override the behavior, e.g. by a service service/provider where users of Angularjs Material can change how Angularjs material figures out when a button should be a link etc...

What is the use-case or motivation for changing an existing behavior?

Making the framework more generic and loosen up the tight coupling to e.g. UI-Router. Allowing for integration to other custom made directives etc. which are suppose to indicate links and so on.

Which versions of AngularJS, Material, OS, and browsers are affected?

v1.1.8

Is there anything else we should know? Stack Traces, Screenshots, etc.

I wanted to submit this as a proposal PR instead of just an issue, but I ran into some ambiguities which requires me to understand the meaning behind before I proceed.

Button definition of isAnchor:

Button use of isAnchor:

List Item use of detection:

List Item attr copy:

Menu Service Provider:

NavBar insertion if attributes:


The last one is probably the most challenging one as it adds bindings etc... But it shouldn't be impossible to make a more flexible design.

But what i don't get is the different ways that "links" are detected:

//button:
angular.isDefined(attr.href) || angular.isDefined(attr.ngHref) || angular.isDefined(attr.ngLink) || angular.isDefined(attr.uiSref);

//list item:
tAttrs.ngClick || tAttrs.ngDblclick ||  tAttrs.ngHref || tAttrs.href || tAttrs.uiSref || tAttrs.ngAttrUiSref

//menu service provider
(hasAnyAttribute(target, ['ng-click', 'ng-href', 'ui-sref'])

etc...

It would be much appreciated if anyone was able to explain that... Then perhasp I could start on a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    P5: nice to haveThese issues will not be fixed without community contributions.needs: investigationThe cause of this issue is not well understood and needs to be investigated by the team or communitytype: enhancement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions