Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update uiSref input type to match functionality #943

Merged
merged 3 commits into from
Dec 2, 2021

Conversation

oBusk
Copy link
Contributor

@oBusk oBusk commented Aug 20, 2021

Was updating our code to try to use strict templates and was noting failures on templates that has been working for years. Noticed that the inputtype to uiSref is "string" when it works just fine with a declaration or object too, since the internal uses all support StateOrName.

Was updating our code to try to use strict templates and was noting failures on templates that has been working for years. Noticed that the inputtype to `uiSref` is "string" when it works just fine with a declaration or object too, since the internal uses all support StateOrName.
@@ -87,7 +87,7 @@ export class UISref implements OnChanges {
* <a uiSref="hoome">Home</a>
* ```
*/
@Input('uiSref') state: string;
@Input('uiSref') state: StateOrName;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be changed on line 125 too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused? L125 in this file?

@Inject(UIView.PARENT_INJECT) parent: ParentUIViewInject

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, typo. I meant Line 135

  /** @internal */
  set uiSref(val: string) { // here
    this.state = val;
    this.update();
  }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I suppose so? But I can't really find anywhere this internal method is being used tbh? Was thinking it was for testing or maybe something angular-hybrid does, but I can't find anywhere we're uiSref is given a value on the class directly

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do believe the setter is how the data-binding is applied

  @Input('uiSref') state: StateOrName;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm well the decorator should bind the directive input "uiSref" to the class property "state". But nevertheless, whatever it's use, the setter should have the same type as the value it sets, I've updated it.

@christopherthielen christopherthielen merged commit fe26fe0 into ui-router:master Dec 2, 2021
@oBusk oBusk deleted the uisref-state-type branch December 2, 2021 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants