I am trying to add fragments to templateCahe in app.run and use ng-include 
, its not working.
below  is my code  and plnkr link 
 http://plnkr.co/edit/p6d0dECPji5kwh9xFuVy?p=preview



<!DOCTYPE html>
<html>

  <head>
    <script data-require="[email protected]" data-semver="1.2.17" 
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js";></script>
    <script data-require="[email protected]" data-semver="2.0.1" 
src="http://code.jquery.com/jquery-2.0.1.min.js";></script>
  </head>

  <body ng-app="myApp">
  
     
    <div ng-include="'tempate1.hml'"></div>

<script type="text/javascript">

    var app=angular.module('myApp', []);
    app.run(function($templateCache,$http) {
        $http.get('ddComponent.html').success(function(template){
            
$templateCache.put('template1.html',$(template).filter('#template1').html());
            
$templateCache.put('template2.html',$(template).filter('#template2').html());
            
$templateCache.put('template3.html',$(template).filter('#template3').html());

            console.log($templateCache.get('template1.html'));
            console.log($templateCache.get('template2.html'));
            console.log($templateCache.get('template3.html'));
        }).error(function () {
            alert('error');
        });
    });
</script>




  </body>

</html>

 #######  template file

<script type="text/ng-template" id="template3">
    <div >
            Content for template 3
    </div>
</script>

<script type="text/ng-template" id="template1">
        <div>
            Content for template1
        </div>
</script>

<script type="text/ng-template" id="template2">
    <div>
         Content for template 2
    </div>
</script>

Please advice.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to