I have quite a big form and was looking at ngMessages
. I wanted to implement this:
<script type="text/ng-template" id="error-messages">
<div ng-message="required">This field is required</div>
<div ng-message="minlength">This field is too short</div>
</script>
would I make a factory method? so I could use it across many different controllers? as the project will have many forms in it? I am not sure how to include this in a factory if that is the correct way. This is what I was thinking whether it is right or not.
(function() {
"use strict";
angular.module("minorApp")
.factory("errorMessage", []);
function errorMessage() {
return // some template
}
})();