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

ng-messages: provide the input-element attributes to be used inside of the ng-message template #10319

Closed
johannesjo opened this issue Dec 4, 2014 · 3 comments

Comments

@johannesjo
Copy link

Would nice to be able to to something like this:

<div ng-message="minlength">Your input should be at least {{attrs.minlength}} characters long</div>

Or even more sophisticated:

<div ng-message="max"
        ng-if="attrs.type='date'">'The date provided should be no later than the {{attrs.max  |date}}</div>

If interested, I could try to provide a pull-request.

@caitp
Copy link
Contributor

caitp commented Dec 4, 2014

It's a cute idea, but I don't think we can really make this work well/generically. You're welcome to have a go at it, but I don't think it's something we want to do.

A more workable solution is really just to put the variables you need to use in scope, and read them directly from there.

@johannesjo
Copy link
Author

@caitp Thank you for being honest. Than I can save myself the trouble.

It should be possible to do this when creating new scope programatically for the directive like it is done here (starting on line 33): https://github.com/johannesjo/ng-fab-form/blob/feature/html-templates/src/ng-fab-form-directive-f.js

But you're right: It feels a little hacky...

@Narretz
Copy link
Contributor

Narretz commented Mar 23, 2016

Dupe of #9849 (although there are currently not tangible plans for that)

@Narretz Narretz closed this as completed Mar 23, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants