dimanche 11 décembre 2016

Show Welcome Message in Angularjs

My Laravel Code is here

<a class="navbar-brand" href="">
    @if (Auth::guest())
        
    @else
        Welcome {!! \Auth::user()->UserName !!}
    @endif
</a>

I am trying to convert this into Angular Js

Here is my code in Html.

<a class="navbar-brand">
    
</a>

and code in Controller

myApp.controller("NavController", ["$scope", "UserModel", function($scope, UserModel) {

    $scope.WelcomeMessage = function() {
        debugger;
        if(UserModel.GetUserObject() !== null) {
            return "Welcome " + UserModel.GetUserObject().UserName;
        }
        else {
            return "Welcome ";
        }
    };
}]);

Controller reference is present in layout file but due to some reasons Controller is not even hitting debugger.

Am I missing something?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire