title: vaadin: integrate angular js using custom layout
body: <p>I tried to integrate angular js application in vaadin by using custom layout like this:</p>
  
  <pre><code>VerticalLayout mainLayout = new VerticalLayout();
      mainLayout.setMargin(true);
      mainLayout.setWidth("1380px");
      setCompositionRoot(mainLayout);
      Panel panel = new Panel();
  
      CustomLayout layout = null;
      try {
           String dynamicHtml = "&lt;div ng-app=\"app\"&gt;..........&lt;/div&gt;";
           layout = 
        new CustomLayout(new   ByteArrayInputStream(dynamicHtml.getBytes()));
      } catch (IOException e) {
          logger.error("could not create custom layaout", e);
      }
   panel.setContent(layout);
   mainLayout.addComponent(panel);
  importJs();
  
  public void importJs() {
  String PATH_TO_JS_SCRIPT = jsURL+"?tata=" + new Date();
  String script = "try{var fileref=document.createElement('script');";
  script += "fileref.setAttribute(\"type\",\"text/javascript\");";
  script += "fileref.setAttribute(\"src\", \"" + PATH_TO_JS_SCRIPT + 
      "\");";
  script += "document.getElementsByTagName(\"head 
  \")[0].appendChild(fileref);}catch(e){alert(e);}";
  Page.getCurrent().getJavaScript().execute(script);
  }
  </code></pre>
  
  <p>I import the script js using importJs method.
  The first time i access the page, the js file is loaded and it works.
  The second time, it does'nt work.
  As if the script is not imported.
  I don't see what is wrong in my code?
  Using Javascript annotation i have the same problem.
  I use
  vaadin 7.6.5
  java 7</p>