angular.js - angular loading issue
阿神
阿神 2017-05-15 16:50:26
0
2
499

Write the following route

javascript$routeProvider.when('/tweet/:name?', {
    controller: ArticleController,
    templateUrl: templateUrl
  }).when('/project/:name?', {
    controller: ArticleController,
    templateUrl: templateUrl
  }).when('/technique/:name?', {
    controller: ArticleController,
    templateUrl: templateUrl
  }).when('/about-me', {
    controller:ArticleController,
    templateUrl: templateUrl
  }).otherwise({
    redirectTo: '/tweet'
  });

But the above settings have no effect when the page is opened for the first time
The corresponding view will not be rendered
Probably because the angularjs script is executed after loading the page for the first time
At this time, the page has been loaded, so the view is not rendered
Is that so?
Websiteblog

阿神
阿神

闭关修行中......

reply all(2)
世界只因有你

If the routing is configured, it will be executed when the page is loaded for the first time. You can check the following aspects to see if there are any problems:

  • AngularJS files are imported
  • Whether ng-app has been added to the corresponding location
  • Whether the routing configuration function is written correctly
  • I really can’t do a unit test

I don’t know if it can solve your problem.

为情所困

angular routing will not render all the pages, so when you open the page for the first time, you will go to the /tweet page and other pages will not be rendered

It will only be rendered when you click on other pages. If /tweet is not displayed, there must be a problem with the code.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template