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

Wishlist: set properties of Custom Elements in templates #16235

Closed
@vivainio

Description

@vivainio

I'm submitting a ...

  • bug report
  • [x ] feature request
  • other (Please do not submit support requests here (see above))

Current behavior:

Currently, you can't property bind HTMLElement properties in templates

Expected / new behavior:

If you have a custom element my-elem, you could property bind it to an expression:

<my-elem ng-prop-myprop="$ctrl.getComplexValue()"></my-elem>

ng.attr doesn't work for this because the value needs to be a string. Properties can be arbitrary complex JS object.

Minimal reproduction of the problem with instructions:

Currently you need to imperatively dig up the HTMLElement and assign the property in js code:

https://gist.github.com/vivainio/7025b4f5c1d90ab168981419f735d73a

AngularJS version: 1.6

Browser: [all | Chrome XX | Firefox XX | Edge XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

All.

Anything else:

Relevant blog post that illustrates the "clumsier" (imperative) way of doing this: https://medium.com/@vivainio/using-stenciljs-components-in-angular-1-application-2f09287c151

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions