angularjs - Gather both first and lastname into a full name -
i started working first app angular such must have showcased full name when 1 has written both names first , last name.
what mean few first name , last name , indicate full name overall. right problem such not add full name total @ all.
userscreate.js - (i'm sure fault lies around here)
var usercreatennow = angular.module('usercreatennow', []); usercreatennow.controller('createusernow', function ($scope) { //checking on first name , surname written. if ($scope.name != null && $scope.lastname != null) { //prints $fullname = "welcome " + $scope.name + " " + $scope.lastname; } });
create.cshtml
<div ng-app="usercreatennow" ng-controller="createusernow"> <div class="form-group"> <div class="col-xs-12"> @html.labelfor(u => u.fornavn) @html.textboxfor(u => u.fornavn, new { @class = "form-control", @ng_model = "name", @placeholder = helpertextclass.helpertext.placeholderinfo.fornavn }) @html.validationmessagefor(u => u.fornavn, "", new { @class = "label label-danger" }) </div> </div> <div class="form-group"> <div class="col-xs-12"> @html.labelfor(u => u.efternavn) @html.textboxfor(u => u.efternavn, new { @class = "form-control", @ng_model = "lastname", @placeholder = helpertextclass.helpertext.placeholderinfo.efternavn }) @html.validationmessagefor(u => u.efternavn, "", new { @class = "label label-danger" }) </div> </div> <div class="form-group"> <div class="col-xs-12"> <p class="label label-danger"></p> <button type="submit" class="btn btn-effect-ripple btn-success"><i class="fa fa-plus"></i> create user {{fullname}}</button> </div> </div> </div>
$fullname
not on scope. try this:
//prints $scope.fullname = "welcome " + $scope.name + " " + $scope.lastname;
Comments
Post a Comment