我已将我登录的会话数据存储在php(laravel)会话中,我如何将其用于我的角度js控制器。
<body ng-app="registerform">
<p ng-init="userdata={userid:".<?php echo Session::get('userid');?>."}"></p>
<div id="left-section">
<div class="header">
<a href="" class="logo"><?php echo ucfirst(Session::get('username')); ?></a>
<div class="user-info">
<a href=""><img src="img/avatar.png"><i class="arrow_box"></i></a>
</div>
<div class="menu">
<ul class="nav">
<li><a href="#" class="active"><i class="glyphicon glyphicon-envelope"></i><span>Dashboard</span></a></li>
<li><a href="#postJob"><i class="glyphicon glyphicon-pencil"></i><span>Post Job</span></a></li>
<li><a href="#viewApplicants"><i class="glyphicon glyphicon-user"></i><span>View Applicants</span></a></li>
<li><a href=""><i class="glyphicon glyphicon-cog"></i><span>Settings</span></a></li>
<li><a href=""><i class="glyphicon glyphicon-book"></i><span>Book</span></a></li>
</ul>
</div>
</div>
</div>
<div id="right-section">
<div class="header">
<h5>Header </h5>
</div>
<div class="main-data-container">
<div ng-view></div>
</div>
</div>
我刚刚尝试过这种方式但是出现了错误,这是最好的方法。