title: Link to #ID element from another page in AngularJS
body: <p>I've tried all the solutions presented here:
  <a href="https://stackoverflow.com/questions/14712223/how-to-handle-anchor-hash-linking-in-angularjs">How to handle anchor hash linking in AngularJS</a></p>
  
  <p>But none worked for me. </p>
  
  <p>In my <code>header.html</code> I have a link: <code>&lt;a id="button" href="#/views/home#page"&gt; Contact&lt;/a&gt;&lt;/li&gt;</code></p>
  
  <p>To an ID in <code>home.html</code></p>
  
  <p>When I am in <code>/home</code> it works, but when I am in another page it doesn't work.</p>
  
  <p>I tried using <code>##page</code> with no success.
  Or putting this in app.js:</p>
  
  <pre><code>app.run(function($rootScope, $location, $anchorScroll, $routeParams) {
    $rootScope.$on('$routeChangeSuccess', function(newRoute, oldRoute) {
      $location.hash($routeParams.scrollTo);
      $anchorScroll();  
    });
  });
  </code></pre>
  
  <p>and customizing my link:</p>
  
  <pre><code>href="#/views/home/?scrollTo=page"
  </code></pre>
  
  <p>Can someone explain which files should I edit and how?</p>
  
  <p><strong>Edit</strong>: 
  I started from <a href="https://github.com/angular/angular-seed" rel="nofollow noreferrer">Angular-Seed</a></p>
  
  <p>My <code>app.js</code> is:</p>
  
  <pre><code>'use strict';
  
  // Declare app level module which depends on views, and components
  angular.module('myApp', [
    'ngRoute',
    'myApp.view1',
    'myApp.view2',
    'myApp.training',
    'myApp.faq',
    'myApp.media',
    'myApp.contact',
    'myApp.home',
    'myApp.apply',
    'myApp.classes',
    'myApp.version'
  ]).
  config(['$routeProvider', function($routeProvider) {
    $routeProvider.otherwise({redirectTo: '/views/home'});
  }]);
  </code></pre>
  
  <p>And in every view I have another js file like <code>training.js</code> which looks like:</p>
  
  <pre><code>'use strict';
  
  angular.module('myApp.training', ['ngRoute'])
  
  .config(['$routeProvider', function($routeProvider) {
    $routeProvider.when('/views/training', {
      templateUrl: 'views/training/training.html',
      controller: 'TrainingCtrl'
    });
  }])
  
  .controller('TrainingCtrl', [function() {
  
  }]);
  </code></pre>
  
  <p>It is configured based on angular-seed model.</p>
  
  <p>So, when, I am in view <code>/faq</code> that has the partial <code>header</code> with the menu and all the links, how can I link to a specific ID in view <code>/home</code>?</p>