title: Dynamic Element with AngualrJS $compile
body: <p>I am creating dynamic button and using $compile to bind ng-click event. I am adding two parameters there. Problem is that if the parameter is string and having space in between, Parameter is splitting.</p>
  
  <p>Here is my Javascript code:</p>
  
  <pre><code>var name 'Demo 1';
  var str= 'hello'
  var btnhtml = '&lt;button type="button" class="btn btn-primary btn-xs" ng-click=getShops("' + str + '","' + name + '")&gt;View Detail&lt;/button&gt;';
  temp = $compile(btnhtml)($scope);
  </code></pre>
  
  <p>Generated HTML code looks like following:</p>
  
  <pre><code>&lt;button type="button" class="btn btn-primary btn-xs ng-scope" ng-click="getData("hello","Demo" 1")&gt;View Detail&lt;/button&gt;
  </code></pre>
  
  <p>Where my desired output is:</p>
  
  <pre><code>&lt;button type="button" class="btn btn-primary btn-xs ng-scope" ng-click="getData("hello","Demo1")&gt;View Detail&lt;/button&gt;
  </code></pre>
  
  <p>How can I fix this. Thanks.</p>