Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html ng-app="myapp">
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0-beta.2/angular.min.js"></script>
    <script src="https://code.angularjs.org/1.5.0-rc.0/angular-sanitize.min.js"></script>
</head>
<body ng-controller="AddCtrl">
    <button ng-click="add_Name($index)">Add Names</button>
    <div id="add"></div><br/>
    <form ng-show="showName">
      <label>Name Change(?)</label><br/>
      <input ng-model="my.name">
    </form>
</body>
</html>
 
var app = angular.module('myapp', ['ngSanitize']);
app.controller('AddCtrl', function ($scope, $compile) {
    $scope.my = {name: 'untitled'};
       $scope.add_Name = function (index) {
        var namehtml = '<label ng-click="selectName($index)">{{my.name}} //click<br/></label>';
        var name = $compile(namehtml)($scope);
        angular.element(document.getElementById('add')).append(name);
    };
   
    $scope.selectName = function (index) {
        $scope.showName = true;
    };
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers