JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app="MyApp">
<div ng-controller="MyController">
window.document.title: {{domWindowTitle()}}
</div>
</div>
JavaScript
var app = angular.module('MyApp', []);
app.controller('MyController', function($scope, SomeService, Title){
var serviceData = SomeService.get();
Title.set("Title of the page about " + serviceData.firstname);
$scope.domWindowTitle = function(){
// see what the dom has (can't set paren since fiddle runs in a frame on a different domain t)
return window.document.title;
};
});
app.factory('SomeService', function ($window) {
return {
get: function(){
return { firstname : "Joe" };
}
};
});
app.factory('Title', function ($window) {
return {
set: function(val){
$window.document.title = val;
}
};
});