Skip to content

alonbardavid/angular-nested-include

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

#angular-nested-include

angular-nested-include is an angular.js module that decorates ng-include to allow running an expression after all nested ng-include finished loading.

installation

Get angular-nested-include:

Add angularNestedInclude dependency to your app.

Usage


    --------- app.js ---------
    angular.module("myApp",['angularNestedInclude'])
        .controller("myCtrl",function(scope){
            scope.callAfterLoad= function(){
                //innerDiv should be visible in this function
            }
        })
    
    --------- index.html -------------
    <html ng-app="myApp">
    <script type="text/ng-template" id="/outerTemplate.html">
      <div ng-include="'/innerTpl.html'"></div>
    </script>
    <script type="text/ng-template" id="/innerTemplate.html">
          <div id="innerDiv"></div>
    </script>
    <body ng-controller="myCtrl">
        <div ng-include="'/outerTemplate.html'" on-nested-load="callAfterLoad()"></div>
    </body>
    </html>
    

disclaimer:

angular-nested-include decorates all ng-include directives.
This can cause unexpected slowdowns and might not interact well with other modules that modify or depend on ng-cinlude.

About

ng-include's onload that is called after nested ng-includes are compiled.

Resources

License

Stars

Watchers

Forks

Packages

No packages published