Closed Bigous closed 7 years ago
Using the minimum example in wiki with the latest @angular/cli
and ng build --prod --aot
worked without problems and without any change.
Thou we could use ngc instead of typescript directly to generate the metadata.json
files, but I don't see any need for this for now - it will stay at the fix-34 branch to keep in track in case of future necessity.
I might be having some trouble with this. Works locally but when I do a prod AOT build using the AngularClass https://github.com/AngularClass/angular2-webpack-starter project, cookies don't seem to get set.
I'm just using:
Cookie.set('key','value', 30)
without the domain, path, etc
Anything I need to change to get this to work?
Hi @lincolnthree, I've just tried to do:
git clone --depth 1 https://github.com/angularclass/angular2-webpack-starter.git
cd angular2-webpack-starter
npm install
And them I edited the file src/app.module.ts
adding this 2 lines just after the imports
:
import { Cookie } from 'ng2-cookies';
console.log('This should return false:', Cookie.check('abc'));
And then I tested it:
npm install -g http-server
npm run build:aot:prod
http-server dist/
I opened the chrome pointing to http://localhost:8080/ and looked at the console... it worked as expected. Could you provide more information about your issue?
[]'s
It's possible this was user error, or it's also possible that domains are not being resolved by default in production (e.g. on localhost, it worked fine, but on *.domain.com
it did not.) I ended up doing this manually, but I had some difficulty with the browser API that lead me to try hardcoding the domain a few different ways. One of them finally worked - the fully qualified domain, e.g. www.domain.com
, which worked but domain.com
did not.
If I get a chance I will try using this library again and hardcoding the fully qualified domain (www.domain.com
) -- it's possible having a subdomain is relevant to the issue-- , but the default (leaving the domain blank) did not seem to work for me.
To work properly with AOT (without having to configure manually to have the library compiled together).
It was already mentioned first at #31 and lately at #8.