An AngularJS module that allows for macro definition and invocation. Can be used to form the basis for website templating in a purely Angular way.

Added by: Sam Deering





Stars: 2

Watchers: 2

Forks: 2

Module Description


An AngularJS module that allows for on-the-fly macro definition and use within HTML

How to use

Just include modMacros in your main application, e.g.:

angular.module('myApp',['modMacros', ...]);

Macro Definition

<define macro="'example'">
    this is a simple example of a macro
        substitutions: {{variable1}}, {{variable2}}
        and inner content: {{content}}
        and content subselection: {{content|find:b}}


Macro Invocation

<invoke macro="'example'" variable1="foo" variable2="bar">
    THIS IS {{dynamic}} AND <B>BOLD STUFF</B> 

Simple website template


<define macro="'page'">
            <h1>Standard page header</h1>
            <div class='content'>
            <div class='copyright'>Copyright (c) 2012 {{author}}</div>

then in index.html:

<ng-include src="'page.macro'" />

<invoke macro="'page'" title="some page" author="me">
  This is some little page. 

Module stats last updated: 2015-06-04 11:09:20

Disclaimer: Some data on this page may have been gathered from the authors GitHub respository. If you see any mistakes or outdated information please let us know. Thanks!