效果就是在input中输入地址,在点击链接的时候就会跳转
<body ng-app="myapp">
<input type="text" ng-model="url">
<div fuck-you my-url="url" text-con="点这里"></fuck-you>
</body>
</html>
<script>
angular.module('myapp',[]).directive('fuckYou',function(){
return{
restrict:'A',
replace:true,
scope:{scopeUrl:'=myUrl',textCon:'@'},
template:'<a href="http://'+'{{scopeUrl}}">'+'{{textCon}}</a>'
}
});
</script>