Angular Directive @ vs =
This is a start up using Angular in JSFiddle. Plus it uses Toastr to notify alerts.
by Juan Mendez
HTML
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.css">
<div ng-controller="myController">
<input type="input" ng-model="title" />
<br/>
<p class="jm-find" title1="title" title2="static"></p>
</div>
CSS
.directive {
border: 1px solid red;
width: auto;
padding: 10px;
height: auto;
margin: 10px 0px;
}
JavaScript
var app = angular.module('app', []);
app.controller("myController", function ($scope) {
$scope.title = "binding";
});
app.directive("jmFind", function () {
return {
replace: true,
restrict: 'C',
transclue: true,
scope: {
title1: "=",
title2: "@"
},
template: "<div><p>{{title1}} / {{title2}}</p></div>"
};
});