简体   繁体   中英

How can I call four different pages in same screen using angularjs?

How can I create an assignment with four screens?

  1. Screen with some text
  2. Screen with some images image
  3. Screen with a video

All the screens will be changed automatically one by one with some time factor and the time must me configurable ie you can change time in variable an will be reflected through out the web app.

You can try ng-route.

 <!DOCTYPE html> <html> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-route.js"></script> <body ng-app="myApp"> <p><a href="#/">Main</a></p> <a href="#red">Red</a> <a href="#green">Green</a> <a href="#blue">Blue</a> <div ng-view></div> <script> var app = angular.module("myApp", ["ngRoute"]); app.config(function($routeProvider) { $routeProvider .when("/", { templateUrl : "main.htm" }) .when("/red", { templateUrl : "red.htm" }) .when("/green", { templateUrl : "green.htm" }) .when("/blue", { templateUrl : "blue.htm" }); }); </script> <p>Click on the links to navigate to "red.htm", "green.htm", "blue.htm", or back to "main.htm"</p> </body> </html>

You can read further docs on https://docs.angularjs.org/api/ngRoute/service/ $route

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM