Controller-Based Title Change in Angular

Here is a tip on how to keep nice titles in your AngularJS-based SPA - Single Page Application. The strategy is this: Remember current title (whatever it might be) Set the title to whatever new value you want Observe when the controller gets destroyed and React restoring that previous value in the title controllers.controller('AmazingDetailController', [ '$scope', '$window', function ($scope, $window){ // Sets this controller with the expected initial state // and perform any other initial activity needed $scope.initialize = function () { // Remember the previous title (whatever it might be) $scope.previousTitle = $window.document.title; $window.document.title = 'Amazing Detail!'; // Observes $destroy to restore the title of the page to its original // value once user navigates out of this controller $scope.$on('$destroy', function() { $window.document.title = $scope.previousTitle; }); }; // Does specific behavior 1 // Does specific behavior 2 // ... // Does specific behavior N $scope.initialize(); }]); A realistic use will probably be use a model that is coming from a service from the backend (or cache) or collaborating with other objects somehow. But this strategy is still valid, clean and works like a charm. ...

App, main and other controller accessors

When I’ve started flow, one of the features I wanted for it was scaffolding from the front-end and be able to do things like: Flow scaffold model: #User or: Flow scaffold crudFor: #Task and have created the Model and Controller classes and accessors in environment so you can continue developing the app pulling things from there.

flow

I’m starting this blog here to make a coder-friendly open conversation with contributors and enthusiasts about flow’s design. This blog will be doing two things in one move: A source of fresh input, so feedback, so inspiration. An output about progress on this line of work, so relevance of the mission. But lets back up a bit, what is flow after all? I like to say that flow is a mission with a framework. Here is flow’s mission from the project’s readme:

The way you understood it wrong

When I was doing engineering, I had a very good algebra teacher.* Those were the days full of vectors and subspaces and subspaces of polynomials and matrices and subspaces of matrices of polynomials. All from 7 a.m to 12 p.m. In the middle of that math trench he said once something that my head really saved. The teacher was explaining yet another concept while the sky was still dark in the morning and there was this guy that asked him to clarify a detail. ...

Context is King

When you trust your content is when you can forget it. At that point you’ll get that Context is King. …to make a Leonardo you need more than his innate ability. You also need Florence in 1450. Paul Graham. Yes I know… we are not da Vinci, we don’t have Florence in 1450 nor we have a Medici patron for our talent.