JSFiddle - React, Tailwind, and code Playground
by Bahman ParsaManesh
HTML
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<script>document.write('<base href="' + document.location + '" />');</script>
<link rel="stylesheet" href="style.css" />
<script data-require="[email protected]" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.11/angular.min.js" data-semver="1.5.11"></script>
<script>
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope, $http, testSrv) {
$scope.me = "$scope.answer";
testSrv.setData($scope.me);
});
app.controller('modalCtrl', function($scope, $http, testSrv) {
$scope.you = "$scope.q";
testSrv.setData($scope.you);
});
// Main
app.service('testSrv', function(){
// Data Storage
var data = '';
// Returned Functions
return {
setData : _setData,
}
// Set Data
function _setData(t){
if(t) data = t;
console.log(data);
}
});
</script>
</head>
<body ng-controller="MainCtrl">
<p>Hello {{name}}!</p>
<div ng-controller="modalCtrl">{{data}}</div>
</body>
</html>