I know that this question is ALMOST identical, however my implementation needs to be changed slightly and I can't quite work out what to do.
In the answer I linked, the solution involved using
app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
$routeProvider.
when('/test1', {template: 'page 1', controller: Test1Ctrl})
...
app.factory('Page', function(){
var title = 'default';
return {
title: function() { return title; },
setTitle: function(newTitle) { title = newTitle; }
};
});
function Test1Ctrl($scope, Page) {
Page.setTitle('title1');
}
...
within the app.js
file. However, and I already have a config of the form:
...
$routeProvider
.when("/", {
templateUrl: "partials/landing.html", controller:"landingCtrl"
})
with the controller landingCtrl
defined in another file, controllers.ts
, like this:
class landingCtrl {
public isFirstPlay: any;
constructor($scope) {
$scope.vm = this;
this.isFirstPlay = true;
}
...
so how would I implement a function of the form in the answer I linked with this layout?