start using angular on form
parent
41abdae46f
commit
7a47df4e74
|
@ -42,3 +42,10 @@ $(document).ready(function() {
|
|||
});
|
||||
});
|
||||
|
||||
var profileValidation = angular.module('profileValidation',[]);
|
||||
profileValidation.controller('profileValidationController', ['$scope',
|
||||
function($scope) {
|
||||
$scope.twitterHandle = '@yournamehere';
|
||||
$scope.user.name = req.user.name;
|
||||
}
|
||||
]);
|
||||
|
|
|
@ -1,23 +1,18 @@
|
|||
extends ../layout
|
||||
script.
|
||||
var freecodecamp = angular.module('freecodecamp',[]);
|
||||
freecodecamp.controller('freecodecampController', ['$scope',
|
||||
function($scope) {
|
||||
$scope.twitterHandle = '@yournamehere'
|
||||
}
|
||||
]);
|
||||
|
||||
|
||||
block content
|
||||
.panel(ng-controller="freecodecampController")
|
||||
.panel(ng-controller="profileValidationController")
|
||||
.container.text-center
|
||||
h1 Update your profile here:
|
||||
form.form-horizontal(action='/account/profile', method='POST')
|
||||
input(type='hidden', name='_csrf', value=_csrf)
|
||||
//input(type='hidden', name='_csrf', value=_csrf)
|
||||
//.form-group
|
||||
// label.col-sm-3.col-sm-offset-2.control-label(for='name') Name
|
||||
// .col-sm-4
|
||||
// input.form-control(type='text', name='name', id='name', value='#{user.profile.name}')
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='name') Name
|
||||
.col-sm-4
|
||||
input.form-control(type='text', name='name', id='name', value='#{user.profile.name}')
|
||||
input.form-control(type='text', placeholder='Name', name='name', ng-model='user.name', ng-minlength='3', ng-maxlength='20', required='required', ng-focus='ng-focus', id='name', value='{{user.name}}')
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='username') Username (use letters, numbers, underscore) *
|
||||
.col-sm-4
|
||||
|
|
|
@ -5,7 +5,7 @@ block content
|
|||
.panel-body
|
||||
.row
|
||||
.col-xs-2.col-sm-1.col-md-1
|
||||
img(src="#{picture}")
|
||||
img(src="#{user.picture}")
|
||||
.col-xs-4.col-sm-2.col-md-2
|
||||
h2.nameline
|
||||
= "[ " + user.points + " ]"
|
||||
|
@ -13,8 +13,15 @@ block content
|
|||
h2.nameline
|
||||
= name
|
||||
h4= location
|
||||
a(href="#{coderbyteProfile")
|
||||
a(href="http://twitter.com/#{user.profile.twitterHandle}")
|
||||
|= "@#{twitterHandle} on Twitter"
|
||||
a(href="#{user.profile.coderbyteProfile")
|
||||
| Coderbyte Profile
|
||||
a(href="#{user.profile.linkedin")
|
||||
| LinkedIn Profile
|
||||
a(href="#{user.profile.codepen")
|
||||
| Codepen Portfolio
|
||||
a(href=linkedin)
|
||||
- if (ch[0] > 0)
|
||||
.container
|
||||
h1 Completed Challenges
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
doctype html
|
||||
html(ng-app='freecodecamp')
|
||||
html(ng-app='profileValidation')
|
||||
head
|
||||
script(src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js")
|
||||
script(src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.8/angular.min.js")
|
||||
|
|
Loading…
Reference in New Issue