Skip to main content

Posts

Showing posts from October, 2015

AngularJS - Build a custom validation directive for using multiple emails in textarea

AngularJS already supports the built-in validation with text input with type email. Something simple likes the following:
<input name="input" ng-model="email.text" required="" type="email" /> <span class="error" ng-show="myForm.input.$error.email"> Not valid email!</span>
However, I used a text area and I wanted to enter some email addresses that's saparated by a comma (,). I had a short research and it looked like AngualarJS has not supported this functionality so far. Therefore, I needed to build a custom directive that I could add my own validation functions. My validation was done only on client side, so I used the $validators object.

Note that, there is the $asyncValidators object which handles asynchronous validation, such as making an $http request to the backend.

This is just my implementation on my project. In order to understand that, I supposed you already had experiences with Angular…

9 Most important characters of business emails in English

1. Clarity

- The content should be simple, easily to follow, short words rather than long one.
- Use the active voice, positive words rather than complaint one.

 2. The "One Thing" rule

- Keep the message focused. The another thing should be written in another email.

3. Be political

- The message is in more the two paragraphs, it should be reduced.
- Use "Please" and "thank you"
- Use phrase that states you are not sure of something: I think that..., It is possible..., The optimal solution...

4. Meaning Subject

Bad: Important. Please read
Better: Meeting set for tomorrow at 10AM - Need a room

5. Think before you write

- Don't send e-mails in haste
- Avoid using context (background information)

6. Understand you Audience

- What they like to hear
- See your writing from their perspective

7. Sign-off like a professional

- Add signature block with appropriate contact information

8. Make sure no errors with spelling and grammar before you click the "Send&quo…