Cookies CodeIgniter + Angular solving the problem

Set cookie with code igniter controller and get cookie with Angular

PHP / CODEIGNITER



	public function __construct()
	{
		//Core controller constructor
		parent::__construct();
		$this->load->model('registermodel');
		$this->load->helper('cookie');
	}

	public function controller_register(){

		$request= json_decode(file_get_contents('php://input'), TRUE);

		$check = $this->registermodel->model_register($request);


		if($check=="true"){

			$cookie= array(

					'name'   => 'uname',
					'value'  => $request["email"],
					'expire' => '30000'

			);

			$this->input->set_cookie($cookie);

			echo 'true';
		}

	}

JS / ANGULAR


app.controller("dashboardController", function($scope, $http,$cookies) {

if($cookies.get("uname")==null||$cookies.get("uname")==undefined||$cookies.get("uname")==""){
    window.open('http://topzapp.com/index.php/landingcontroller',"_self")
}else{
    $scope.uname = $cookies.get("uname");
}
});