title: How to include 3rd party javascript libraries in AngularJS partial template?
body: <p>I have got a simple example to try to figure out why my angular partial template can not load another javascript component.</p>
  
  <p>I am using 1 template (singleArticleView.html) and a parent page(blog.html)and i am trying to apply run_prettify.js to a simple code snippet inside of my template. If the code is inside of the template it does not work. If i remove the code and the script tags from the child template and include them inside of the parent it works properly</p>
  
  <p>How can I execute that javascript library inside my template? I think it does not work because DOM elements have loaded later. </p>
  
  <p><strong><em>How can I evaluate if the content in the partial template is already rendered in order to execute any external javascript code to manipulate the DOM?</em></strong></p>
  
  <p>I appreciate any suggestion</p>
  
  <p>It is the code:</p>
  
  <p>blog.html (Parent)</p>
  
  <pre><code>   &lt;script src="~/AngularJS/Controllers/articlesController.js"&gt;&lt;/script&gt;
      &lt;script src="~/AngularJS/Controllers/singleArticleController.js"&gt;&lt;/script&gt;
              &lt;div class="row"&gt;
                      &lt;div class="col-md-8 col-md-offset-1"&gt;
                          &lt;div data-ng-view&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p>singleArticleView.html (template)</p>
  
  <pre><code>            &lt;script src="~/Scripts/run_prettify.js"&gt;&lt;/script&gt;
              &lt;link href="~/Content/prettify.css" rel="stylesheet" /&gt;
  
                           &lt;div&gt;
                                  {{article.author }}
                                  &lt;pre class="prettyprint linenums lang-html"&gt;
                                              &amp;lt;!DOCTYPE html&amp;gt;
                                              &amp;lt;html&amp;gt;
                                                &amp;lt;head&amp;gt;
                                                  &amp;lt;title&amp;gt;Demo | Prettify.JS&amp;lt;/title&amp;gt;
                                                &amp;lt;/head&amp;gt;
                                                &amp;lt;body&amp;gt;
                                                  &amp;lt;h1&amp;gt;Hello, World!&amp;lt;/h1&amp;gt;
                                                &amp;lt;/body&amp;gt;
                                              &amp;lt;/html&amp;gt;
                                  &lt;/pre&gt;
  
                              &lt;/div&gt;
  </code></pre>
  
  <p>singleArticleControlle.js (controller)</p>
  
  <pre><code>(function () {
                  var app = angular.module("dbayonaCode");
                  var singleArticleController = function ($scope, dataService, $window, $routeParams, $sce) {
  
                      $scope.article = {};
                      $scope.newComment = {};
                      //Get the article with its comments to show in the template and add a new comment
                      //It uses ArticlesController.cs
                      dataService.getArticleById($routeParams.id)
                       .then(function (data) {
                           //success
                           $scope.article = data;
                           $scope.myContent = $sce.trustAsHtml(data.body);
  
                       },
  
                       function () {
                           //error
                           $windows.location = "#/";
  
                       });
  
                  }
                  app.controller("singleArticleController", singleArticleController);
              }());
  </code></pre>