Allows you store simple, interpolatable message templates in a single place like done in Rails with the t
helper.
NOTE: This plugin depends on lodash
bower install angular-gs-simple-messages
Include the package in your application:
var app = angular.module('app', ['gs.simple-messages']);
Create a value object to store your templates:
app.value('templates', {
gabe: {
is: {
the: {
best: 'HELLO {{ name }}'
}
}
}
})
Set the templates module as part of your configuration:
app.config(function (messagesProvider) {
messagesProvider.setTemplates('templates');
})
Use it like so:
app.controller('SomeCtrl', function (messages) {
messages('gabe.is.the.best', { name: 'GABE!' }); // => "HELLO GABE!"
messages('gabe.is.the', { name: 'GABE!' }); // => throws error
});