Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html ng-app="app">
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
  <script src="http://yastatic.net/angularjs/1.2.23/angular.min.js"></script> 
</head>
<body>
  <div ng-controller="profiles">
  
     <input type="text" ng-model="name"> <br />
     
     <button dir outername="name">set name to Lisa</button>
    
  </div>
  
  
</body>
</html>
 
app =angular.module('app', []);
app.controller('profiles', function($scope){
  
  $scope.name = 'Bob';
  
});
app.directive('dir', function(){
  
  return{
    
   restrict: 'A',
    scope:{
      outername:"="
    },
   link: function(scope, element, attrs){
      scope.dirname = 'Lisa';
     
     element.on('click', function(){
       
       scope.outername = 'Lisa';   
       scope.$apply();
     });
     
   }   
    
  };
  
});
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers