title: How to set secure flag in my cookie using ngx-cookie-service for Angular?
body: <p>I want to set the secure flag in my cookie when I create it. I think I have the solution but I want to be sure in order to continue. I use the <a href="https://www.npmjs.com/package/ngx-cookie-service" rel="nofollow noreferrer">ngx-cookie-service</a> to set my cookie.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>const now = new Date();
  now.setHours(now.getHours() + 8);
  const secureFlag = true;
  this.cookieService.set('usertype', 'agent', now, '/', '/', secureFlag);
  </code></pre>
  
  <p>The thing is that I don't know if I have to declare the 4th and 5th parameter like that because if I don't declare them it shows error.</p>
  
  <p>For example I try this:</p>
  
  <pre><code>const now = new Date();
  now.setHours(now.getHours() + 8);
  const secureFlag = true;
  this.cookieService.set('usertype', 'agent', now, secureFlag);
  </code></pre>
  
  <p>and it warns me with <code>Argument of type 'true' is not assignable to parameter of type 'string'</code></p>
  
  <p>Do I have to use <code>'/'</code> for <code>path</code> and <code>domain</code> parameters when I don't want to define them?</p>