DEV Community

Cover image for How to set value of input field in angular template
Adrian Matei for Codever

Posted on • Originally published at codever.dev

8

How to set value of input field in angular template

To set the initial value of the input control, just use the value attribute:

<input type="text" class="form-control" placeholder="Generate Codever sharable Url"
       aria-describedby="basic-addon2"
value="{{ environment.HOST + '/bookmarks/shared/' + shareableId}}">
Enter fullscreen mode Exit fullscreen mode

Project: codever - File: social-share-dialog.component.html

To understand usage of angular environment used in this snippet (environment.HOST)
see the Configure and use environment specific values in Angular and html template snippet


Reference -

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input


Shared with ❤️ from Codever. Use 👉 copy to mine functionality to add it to your personal snippets collection.

Codever is open source on Github⭐🙏

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay