AngularJS widget data not persisting after changing routes despite using factory

So I’m currently trying to host/embed Medium blog posts on an angularJS site that uses angular routing (SPA). I’ve discovered a widget that does this from, and I’ve had success at getting it to load on my blog route/view, however when I change routes/views and return to the blog the widget fails to load as it thinks the widget data is now undefined.

So I know you can persist data through route changes by using a factory, so I have this factory made to save the related data:

var app = angular.module('myApp', ['ngRoute', 'ngAnimate', 'ngSanitize']);

app.config(function($routeProvider) {
    .when('/blog', {
      templateUrl: 'views/blog.html',
      controller: 'blogCtrl'

app.factory('mediumFactory', function() {
  var data = MediumWidget;
  var service = {};
  service.getData = function() {
    return data;
  return service;

In my blog controller, I have this to initialize the widget for my blog view (this is copy/pasted from the Medium widget site):

angular.module('myApp').controller('blogCtrl', function($scope, mediumFactory) {
  $ = mediumFactory.getData();
    renderTo: '#medium-widget',
    params: {
      "resource": "",
      "postsPerLine": 2,
      "limit": 4,
      "picture": "big",
      "fields": ["description", "publishAt"],
      "ratio": "landscape"

The HTML is just a div with an ID and nothing else so this is angularJS-specific.

I’m not too sure why I’m getting an undefined error when I change routes then go back to the blog view, as the factory should be saving the data, and the controller simply initializes it upon it being loaded?

Source: AngularJS