[AngularJS]replace: true

In directive, if set 

replace: true

it will replace the directive element in html.

 

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>Angular Scope &</title>
    <link href="foundation.min.css" rel="stylesheet"/>
    <script src="angular.min.js"></script>
    <script src="app.js"></script>
</head>
<body ng-app="callApp">
    <dump-password></dump-password>
</body>
</html>

 

/**
 * Created by Answer1215 on 8/23/2014.
 */
var app = angular.module("callApp", []);

app.directive('dumpPassword',function(){
    return{
        restrict: 'E',
        template: '<div> <input type="text" ng-model="model.text"> <div>{{model.text}}</div></div>',
        replace:true
    }
});

 

posted @ 2014-08-25 16:40  Zhentiw  阅读(513)  评论(0)    收藏  举报