JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app="myApp" ng-controller="MainController">
<div alert="" toast="" param="message"></div>
</div>
JavaScript
angular.module("myApp", [])
.controller("MainController", function ($scope) {
$scope.message = "Hello World!";
})
.directive("alert", function(){
return{
restrict: "A",
scope: {
param: "="
},
link: function(scope){
console.log("Alert: " + scope.param);
}
}
})
.directive("toast", function(){
return{
restrict: "A",
link: function(scope, elem, attrs){
var param = scope.$eval(attrs.param);
console.log("Toast: " + param);
}
}
})