javascript - How to use Angular data within a quoted string -


In short : I am trying to pass string to the angular function on ng-click . The string must have embedded data inside the angular world (string is a steady piece and an angular 'variable') ...

     Therefore, how can I correct / resize / modify the string so that the embedded angular content is passed within the string on ng-click.  

HTML

& lt; Div id = "parent" ng-controller = "test" & gt; & Lt; P & gt; {{Name}} & lt; / P & gt; & Lt; Button ng-click = "hello ('s / ms {{name}}')" & gt; Test & lt; / Button & gt; & Lt; / Div & gt;

JavaScript

  $ (document) .ready (function () {var app = angular.module ("app" , []); App.controller ("test", function ($ scope) {$ scope.name = "Samuel"; $ scope.hello = function (val) {alert ("hello" + val);}}} ); Angular.bootstrap (document, ["app"]);});  

Just use the classic javascript variable, not angular expression

  ng-click = "hello ('shri / ms' + name)"  

Comments