hi guys need change existing profile name in settings page. 1. first name must displayed in username: {{name}} 2. have given button show dialog box change name, when clicked save name must changed , displayed in username:{{name}} needed.. need code below, code example..
var app = angular.module('angularapp', ['ngmaterial']); app.controller('settingctrl', ['$scope', '$mddialog', function($scope, $mddialog) { $scope.name = "test"; $scope.changename = function(ev) { $mddialog.show({ controller: setdialogcontroller, template: '<md-dialog aria-label="add insert" md-theme="dialogtheme"><md-content>' + '<form name="changename"><div layout layout-sm="column"><md-input-container flex>' + '<label>client name</label><input ng-model="newname" placeholder="new name">' + '</md-input-container><div></form> </md-content>' + '<div class="md-dialog-actions" layout="row"> <span flex></span>' + '<md-button ng-click="cancel()"> cancel </md-button>' + '<md-button ng-click="saveclient()" class="md-warn"> save </md-button>' + '</div></md-dialog>', targetevent: ev, clickoutsidetoclose: true }) .then(function(answer) { $scope.status = 'you said information "' + answer + '".'; }, function() { $scope.status = 'you cancelled dialog.'; }); }; } ]); function setdialogcontroller($scope, $mddialog) { $scope.saveclient = function() {} $scope.cancel = function() { $mddialog.cancel(); }; };
<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <title>viewsalesvisit</title> <!-- <link href="css/style.css" rel="stylesheet"> --> <link href="js/angular-material.min.css" rel="stylesheet"> <!-- cordova script (this 404 during development) --> <!-- <script src="cordova.js"></script> --> <script src="js/angular.min.js"></script> <script src="js/angular-material.min.js"></script> <script src="js/angular-aria.min.js"></script> <script src="js/angular-animate.min.js"></script> <!-- app's js --> <script src="js/app.js"></script> </head> <body ng-app="angularapp" ng-controller="settingctrl"> <div> <md-content md-scroll-y> <md-toolbar class="md-toolbar-tools" layout-align="center"> <h3>settings</h3> </md-toolbar> <div> <h1>username: {{name}}</h1> <md-button class="md-primary md-raised" ng-click="changename($event)" flex="100" flex-gt-md="auto"> change username </md-button> </div> </md-content> </div> </body> </html>
thank in advance guys..
Comments
Post a Comment