We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Rendering ejangular directives using ng-repeat

We can use AngularJS directive ng-repeat to iterate data with ejangular directive rendering. With this scenario AngularJS does not compile expressions ({{data}}) before ejangular directives rendering. So, we can’t access the compiled data with ejangular directives.

Since need to compile AngularJS expressions manually to render ejangular directives with ng-repeat. To do that define AngularJS custom directive called ejcompile to compile expressions. Use the below code snippet for ejcompile directive.

angular.module('syncApp', ['ejangular', 'samplecontrol'])

            .directive('ejcompile', function ($compile, $interpolate) {

                return {

                    restrict: 'EA',

                    replace: true,

                    compile: function ($scope, $elm, $attrs) {

                        return {

                            pre: function ($scope, $elm, $attrs) {

                                let html = $interpolate($elm.html())($scope);








After defining ejcompile directive, add this custom directive in parent tag of ejangular directive. Refer to the below code snippet.

<div ng-repeat="i in ['WARN','SUCCESS','ERROR']" style="margin-left: 20px; display: inline-table">

            <div ejcompile>

                <button id="button_{{i}}" ej-button e-text={{i}}></button>





In the above example, the ej-button directive will be rendered with compiled expressions (ID attribute appended with ng-repeat array values) as like the below


Article ID: Published Date: Last Revised Date: Platform: Control:
8170 11/23/2017 11/23/2017 JavaScript General
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.