JSFiddle - React, Tailwind, and code Playground
by dingen2010
HTML
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<script>
angular.module('app', ['appServices'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/mypage', {
templateUrl: 'mypage.html',
controller: mycontroller
})]});
function mycontroller($scope, myfactory) {
myfactory.settitle("this is mypage title");
}
angular.module('appServices', [])
.factory('myfactory', function($rootScope) {
var thistitle = "nothing";
return {
settitle: function(title) {
thistitle = title;
},
title: function() {
return thistitle;
}
}
})
</script>
<div ng-controller="mycontroller" ng-app="app">
<script type="text/ng-template" id="mypage.html">
hello {
{
myfactory.title()
}
}
</script>
</div>