Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to include multiple links and insert them in the middle of a sentence? #43

Closed
DaYuClo opened this issue Mar 26, 2019 · 2 comments
Labels

Comments

@DaYuClo
Copy link

DaYuClo commented Mar 26, 2019

I searched through the documentation but cannot find the answers to the following questions.

Question 1: Is it possible to have more than one links?

Question 2: Is it possible to insert the link in the middle of a sentence instead of at the end by default?

Default:

This website use cookies to ensure you get the best experience on our website. Privacy Policy

What I want:

By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service.

Is it possible?

Thank you.

@tinesoft
Copy link
Owner

tinesoft commented Mar 28, 2019

Hi @DaYuClo

Question 1: Is it possible to have more than one links

Question 2: Is it possible to insert the link in the middle of a sentence instead of at the end by default?

Yes, you can totally customize the appearance of the cookie bar as you wish.

I have added a new section in the README to describe how this can be achieved.
Plus, i have softened some types definitions to avoid typescript compilation errors when defining custom properties. Please update to v2.2.0

Then in your case, the following configuration can be used to achieve what you described:

import {NgcCookieConsentModule, NgcCookieConsentConfig} from 'ngx-cookieconsent';

const cookieConfig:NgcCookieConsentConfig = {
  cookie: {
    domain: 'localhost'// it is recommended to set your domain, for cookies to work properly
  },
  palette: {
    popup: {
      background: '#000'
    },
    button: {
      background: '#f1d600'
    }
  },
  theme: 'edgeless',
  type: 'opt-out',
  layout: 'my-custom-layout',
  layouts: {
    "my-custom-layout": '{{messageLink}}{{compliance}}'
  },
  elements:{
    messageLink: `
    <span id="cookieconsent:desc" class="cc-message">{{message}} 
      <a aria-label="learn more about cookies" tabindex="0" class="cc-link" href="{{cookiePolicyHref}}" target="_blank">{{cookiePolicyLink}}</a>, 
      <a aria-label="learn more about our privacy policy" tabindex="1" class="cc-link" href="{{privacyPolicyHref}}" target="_blank">{{privacyPolicyLink}}</a> and our 
      <a aria-label="learn more about our terms of service" tabindex="2" class="cc-link" href="{{tosHref}}" target="_blank">{{tosLink}}</a>
    </span>
    `,
  },
  content:{
    message: 'By using our site, you acknowledge that you have read and understand our ',
    
    cookiePolicyLink: 'Cookie Policy',
    cookiePolicyHref: 'https://cookie.com',

    privacyPolicyLink: 'Privacy Policy',
    privacyPolicyHref: 'https://privacy.com',

    tosLink: 'Terms of Service',
    tosHref: 'https://tos.com',
  }
};


@NgModule({
  declarations: [AppComponent, ...],
  imports: [NgcCookieConsentModule.forRoot(cookieConfig), ...],  
  bootstrap: [AppComponent]
})
export class AppModule {
}

@DaYuClo
Copy link
Author

DaYuClo commented Mar 28, 2019

@tinesoft I really appreciate your work and help. Kudo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants