title: Angular 2 with CodeIgniter
body: <p>I searched a lot but unable to find the solution for this.</p>
  
  <p>In angular 1.x, I used to include js in php pages and load the pages from server side code like CodeIgniter controller.</p>
  
  <p>In <strong>angular 2.x</strong>, I unable to figure out that how I use server side features like $_SESSION?</p>
  
  <p>e.g. I want to insert the data to mysql table and I will send data using POST service of Angular 2. How can I achieve that which user is logged in and created that record??</p>
  
  <pre><code>$city = $this-&gt;input-&gt;post("city");
  $specialty= $this-&gt;input-&gt;post("specialty");
  
  $data = array("city"=&gt;, "specialty"=&gt;$specialty, "createdBy"=&gt;$this-&gt;session-&gt;userdata("userid"));
  
  $this-&gt;db-&gt;insert("citywise", $data);
  </code></pre>
  
  <p>How to get this <code>$this-&gt;session-&gt;userdata("userid");</code> because application is loading at client and everything is handling like REST services.</p>
  
  <p>Using <code>localStorage</code> I can get login data on client browser but what about server?</p>