Home Web Front-end JS Tutorial How to implement timeline in angularjs

How to implement timeline in angularjs

Jun 23, 2018 pm 04:55 PM
angularjs timeline

This article mainly introduces the sample code of angularjs to achieve the timeline effect. The editor thinks it is quite good. Now I will share it with you and give it as a reference. Let’s follow the editor and take a look.

1. Introduce the package

Introduce the angular-timeline package.

Download address: angular-timeline.zip

Introduce

<link href="lib/angular-timeline/dist/angular-timeline.css" rel="external nofollow" rel="stylesheet">
<script src="lib/angular-timeline/dist/angular-timeline.js"></script>
Copy after login

in index.html and quote it in app.js. If you don’t quote it, it will have no effect. .

2 Rewrite css

Rewrite css according to needs, rewrite the core part.

can be written in style.css, or you can create a new css file, but it must be quoted in index.html.

/* 时间轴 */
.timeline-event {
 margin-bottom: 0px !important;
}

timeline-badge.infos {
 background-color: #47d09e !important;
}

.timeline:before {
 width: 1px !important;
 left: 24px !important;
 margin-top: 30px !important;
 background-color: #47d09e !important;
}

timeline-badge {
 left: 16px !important;
 width: 15px !important;
 height: 15px !important;
 top: 15px !important;
 box-shadow: none !important;
}

timeline-panel {
 float: left !important;
 width: 85% !important;
 padding: 13px 0px 6px 0px !important;
 margin-left: 39px !important;
 background: none !important;
 border: none !important;
 box-shadow: none !important;
}

timeline-panel:before {
 visibility: hidden !important;
}

timeline-panel:after {
 visibility: hidden !important;
 display: none !important;
}

timeline-panel .time {
 font-size: 14px;
 font-family: &#39;PingFangSC-Regular&#39;;
}

timeline-panel .detail {
 display: flex;
 display: -webkit-flex;
 align-items: center;
 -webkit-align-items: center;
 justify-content: space-between;
 -webkit-justify-content: space-between;
 margin-top: 10px;
}

timeline-panel .detail .linename {
 font-size: 16px;
 max-width: 80%;
 color: #1c1c1c;
 display: inline-block;
 font-family: &#39;PingFangSC-Medium&#39;;
}

timeline-panel .detail .linelevel {
 position: absolute;
 right: 18%;
 border-radius: 4px;
 color: white;
 padding: 1px 5px 1px 5px;
 font-size: 11px;
}

timeline-panel .detail .linelevel-g {
 background-color: #f27373;
}

timeline-panel .detail .linelevel-p {
 background-color: #e29431;
}

timeline-panel .detail .linenum {
 float: right;
 font-size: 14px;
 color: #323232;
}
Copy after login

Three pages

The preparation work is done, the following is the preparation of the page.

<!--html页面-->
<ion-view view-title="{{title}}">
 <ion-content scroll="true">

  <timeline>
   <timeline-event ng-repeat="event in teamDataList" side="right">
    <timeline-badge class="infos">
    </timeline-badge>
    <timeline-panel class="infos">
       <span class="time">
        {{event.hour}}
       </span>
     <p class="detail" ng-repeat="item in event.data">
      <span class="linename">{{item.customerName}}</span>
      <p style="float: right;">
         <span class="linenum">
         {{item.reserveNumber}}人
         </span>
      </p>

     </p>
    </timeline-panel>
   </timeline-event>
  </timeline>

 </ion-content>
</ion-view>
Copy after login
//controller
angular.module(&#39;studyApp.controllers&#39;)

 .controller(&#39;TimeLineCtrl&#39;, function ($scope, $rootScope, $location) {
  $scope.title = &#39;时间轴&#39;;

  makeData();

  function makeData() {
   $scope.teamDataList=[

    {
     hour:"12:00",
     data:[
      {
       customerName:"中国国旅(江苏)国际旅行社有限公司",
       reserveNumber:"12",
       id:"aaaabbb12112"
      },
      {
       customerName:"江苏2",
       reserveNumber:"122",
       id:"aaaabbb12112"
      }
     ]
    },
    {
     hour:"13:00",
     data:[{
      customerName:"江苏2",
      reserveNumber:"112",
      id:"aaaabbb12112"
     }]

    },
    {
     hour:"14:00",
     data:[{
      customerName:"江苏3",
      reserveNumber:"12",
      id:"aaaabbb12112"
     }]

    },
    {
     hour:"13:00",
     data:[{
      customerName:"江苏2",
      reserveNumber:"112",
      id:"aaaabbb12112"
     }]

    },
    {
     hour:"14:00",
     data:[{
      customerName:"江苏3",
      reserveNumber:"12",
      id:"aaaabbb12112"
     }]

    }
   ];

  }

 });
Copy after login

Four renderings

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

How to use JS to remove duplicate json

##How to use js cookie to implement the shopping cart function

How to use the Validate plug-in in jQuery

How to use axios to upload images with a progress bar function

The above is the detailed content of How to implement timeline in angularjs. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to create a timeline in PPT How to create a timeline in PPT Mar 20, 2024 pm 04:11 PM

Many friends always feel that when making PPT, the production is too monotonous and does not highlight the characteristics of everyone or everything in it. So, in order to make our PPT less monotonous and present our content in a more organized manner, we can use the timeline in PPT to make the PPT more vivid. So how can we use the timeline in PPT? How about making it more lively and interesting? Next, let’s take a look at it with the editor. Once you learn it, you can show it off in front of your friends. 1. First open PPT, create a new blank document, then click [Insert], click [SmartArt Graphics] 2. Click [Process], click on any one, and then press OK. 3. We can do it as we like

How to develop timeline functionality using PHP How to develop timeline functionality using PHP Aug 18, 2023 pm 11:39 PM

Introduction to how to use PHP to develop the timeline function: Timeline is a common function to display timelines, which can arrange events in chronological order so that users can clearly understand the development and sequence of events. PHP is a scripting language widely used in web development. It has powerful data processing and database operation capabilities, and is suitable for developing timeline functions. This article will introduce how to use PHP to develop timeline functions and provide code examples. Steps: Create database and data table First, we need to create a database and corresponding data

The latest 5 angularjs tutorials in 2022, from entry to mastery The latest 5 angularjs tutorials in 2022, from entry to mastery Jun 15, 2017 pm 05:50 PM

Javascript is a very unique language. It is unique in terms of the organization of the code, the programming paradigm of the code, and the object-oriented theory. The issue of whether Javascript is an object-oriented language that has been debated for a long time has obviously been There is an answer. However, even though Javascript has been dominant for twenty years, if you want to understand popular frameworks such as jQuery, Angularjs, and even React, just watch the "Black Horse Cloud Classroom JavaScript Advanced Framework Design Video Tutorial".

Use PHP and AngularJS to build a responsive website to provide a high-quality user experience Use PHP and AngularJS to build a responsive website to provide a high-quality user experience Jun 27, 2023 pm 07:37 PM

In today's information age, websites have become an important tool for people to obtain information and communicate. A responsive website can adapt to various devices and provide users with a high-quality experience, which has become a hot spot in modern website development. This article will introduce how to use PHP and AngularJS to build a responsive website to provide a high-quality user experience. Introduction to PHP PHP is an open source server-side programming language ideal for web development. PHP has many advantages, such as easy to learn, cross-platform, rich tool library, development efficiency

VUE3 Getting Started Tutorial: Using the Vue.js plug-in to encapsulate the timeline component VUE3 Getting Started Tutorial: Using the Vue.js plug-in to encapsulate the timeline component Jun 15, 2023 pm 09:09 PM

Vue.js is a very popular JavaScript framework that is widely used in front-end development. With the continuous development of Vue.js, new versions of VUE3 have also been launched one after another. This article will introduce an introductory tutorial on how to use the Vue.js plug-in to encapsulate the timeline component. First, we need to understand the basic structure of the timeline component. The timeline component can be used to display events over a period of time, including time and event content. Under normal circumstances, the timeline will be arranged in the order in which events occurred, making it more intuitive for users.

Build web applications using PHP and AngularJS Build web applications using PHP and AngularJS May 27, 2023 pm 08:10 PM

With the continuous development of the Internet, Web applications have become an important part of enterprise information construction and a necessary means of modernization work. In order to make web applications easy to develop, maintain and expand, developers need to choose a technical framework and programming language that suits their development needs. PHP and AngularJS are two very popular web development technologies. They are server-side and client-side solutions respectively. Their combined use can greatly improve the development efficiency and user experience of web applications. Advantages of PHPPHP

How to use timeline to display data changes in Highcharts How to use timeline to display data changes in Highcharts Dec 17, 2023 pm 03:06 PM

Timeline is one of the most commonly used components in data visualization. When displaying data changes, using a timeline can make data changes more intuitive and easy to understand. Highcharts is a very powerful data visualization tool that supports a variety of graph types and interaction methods, including timeline support. This article will introduce how to use the timeline in Highcharts to display data changes and provide specific code examples. Preparing data First you need to prepare a set of data for display. This article uses a city in each year

How to create timeline animation in PPT How to create timeline animation in PPT Mar 26, 2024 pm 03:40 PM

1. After creating the presentation, stay on the single page where you want to create a timeline, right-click and select [Background]. On the right side there will be a window with all settings for the background. Set the background color and other settings you need. 2. After the background is set, you can create the [axis] of the timeline. The specific operations are: (1) Insert [rectangle], (2) Check the height of the rectangle (the size of this shape can be set at will). (3) Insert another shape-triangle. (4) Rotate the triangle so that one side is vertical. (5) Select the triangle and set its height to the same value as the height of the rectangle. (6) Connect the triangle to the rectangle. 3. Change the color of the timeline, specific operations: (1) Hold down CTR

See all articles