JSFiddle - React, Tailwind, and code Playground
by dream apple
HTML
<div ng-app="MyApp">
<div ng-init="person.name = 'dreamapple'">周围的作用域:{{person.name}}
<div my-directive hello="dream"></div>
<div my-second-directive></div>
</div>
</div>
JavaScript
angular.module("MyApp", [])
.directive("myDirective", function () {
return {
restrict: "AE",
template: "<div>Hello {{person.name}}</div>",
scope: {
@ = hello
}
}
})
.directive("mySecondDirective", function () {
return {
restrict: "AE",
template: "<div>Hello {{person.name}}</div>",
scope: true
}
});