Home > Web Front-end > JS Tutorial > Detailed explanation of the sample code for the user's password modification function in AngularJS front-end page operation

Detailed explanation of the sample code for the user's password modification function in AngularJS front-end page operation

黄舟
Release: 2017-03-27 14:29:57
Original
1854 people have browsed it

This article mainly introducesAngularJSThe function of users changing passwords in front-end page operations. It analyzes AngularJS’s judgment operation implementation skills for front-end users to change passwords based on specific examples. Friends in need can refer to the following

The example of this article describes the user password modification function of AngularJS front-end page operation. I would like to share it with you for your reference. The details are as follows:

I have been doing front-end design recently. The main knowledge I use is AngularJS and nodejs for page display and data request and processing. When designing a page such as a forgotten password, it is important to find an effective design idea.

Take changing the password as an example. To display the prompt information to the user in a friendly manner and clearly tell the user which part of the operation has a problem, this requires defining detailed variables and functions. Display information at different locations on the page. The code below is a simple example written by myself to record the learning process.

changePwd

var app = angular.module("myapp",[]);
app.controller('changPwdCtrl',function($scope){
  $scope.name = "xiaozhang";
  $scope.pwd = "hello";
  $scope.newPwd = "hello1";
  $scope.rNewPwd = "hello2";
  $scope.submit = function (){
    $scope.reseltNotRule = '';
    $scope.resultNotSame = '';
    $scope.result = '';
    $scope.resultSuccess = '';
    if(!($scope.name&&$scope.pwd&&$scope.newPwd&&$scope.rNewPwd)){
      $scope.result = "请填写完整";
    }else if ($scope.newPwd != $scope.rNewPwd) {
      $scope.resultNotSame = "两次密码不一致";
    }else if ($scope.pwd == $scope.newPwd) {
      $scope.result = "新旧密码不能一致";
    }
  }
});
Copy after login

The specific display information can be concretized later. The basic idea is to use angular's two-way data binding to perform data analysis to display different information. .

The above is the detailed content of Detailed explanation of the sample code for the user's password modification function in AngularJS front-end page operation. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template