Angular:
http://angularjs.org/
by mrajcok
HTML
<div ng-controller="MyCtrl">
<input-filter></input-filter>
</div>
JavaScript
var myApp = angular.module('myApp',[]);
myApp.run(function($rootScope){
$rootScope.mymodel = 'search.name';
})
myApp.directive('inputFilter', function($rootScope){
return{
restrict: 'E',
replace:true,
controller: function($scope, $rootScope){
console.log($scope, $scope.mymodel);
console.log($rootScope.mymodel)
},
template: '<input class="filter" type="text" ng-model="' + $rootScope.mymodel + '" placeholder="Nach filtern">'
}
});
//myApp.factory('myService', function() {});
function MyCtrl($scope) {
$scope.search = { name: 'Superhero'};
}