var app = angular.module("phoneApp", []);

app.controller("AppCtrl", function($scope) {

});

app.directive("panel", function() {
    return {
        restrict: "E",
        transclude: true,
        template: '<div class="panel" ng-transclude>This is a panel component</div>'
    }
})
<!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 >
<div ng-app="phoneApp">
    <div ng-controller="AppCtrl">
        <panel>
            <div class="button">Click me!</div>
        </panel>
    </div>
</div>
</body>
</html>

[AngularJS] Transclude -- using what existing in DOM to replace the template elements in directive[AngularJS] Transclude -- using what existing in DOM to replace the template elements in directive

相关文章:

  • 2021-08-21
  • 2021-07-20
  • 2022-01-03
  • 2021-10-03
  • 2022-12-23
  • 2021-08-12
  • 2022-12-23
  • 2021-07-14
猜你喜欢
  • 2021-11-10
  • 2021-11-30
  • 2021-10-28
  • 2022-02-20
  • 2021-09-28
  • 2022-12-23
  • 2021-08-30
相关资源
相似解决方案