question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Specifying the theme path in Angular2

See original GitHub issue

I am trying to change the theme, used by ng2-ace-editor, to ‘clouds’ using this.editor.setTheme('clouds'). I tried various path variants like 'brace/theme/cloudsetc - to no avail. What is the way of setting thebasePath` (which I think I need) in Angular2 (TypeScript)?

Looked at AceEditorComponent.prototype.setTheme in ng2-ace-editor.js and saw the name of the theme is concatenated to ace/theme/- it does not work for me though. DevTools spit out a 404 because of http://localhost:4200/theme-clouds.js Wondering what the problem could be.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
moniuchcommented, Oct 26, 2016

My eye slipped over this comment:

//to use theme "eclipse" 
//with angular-cli add "../node_modules/ace-builds/src-min/ace.js" and "../node_modules/ace-builds/src-min/theme-eclipse.js" to "scripts" var into the file angular-cli.json 

now everything runs fine. Just unsure if npm rebuild was needed or restarting ng serve would suffice

0reactions
z3phyrocommented, Nov 20, 2018

@ScottSpittle Thank you for your insights… Finally what worked for me was to add this:

<script src="assets/ace/ace.js" type="text/javascript" charset="utf-8"></script>
  <script>
    const path = '/assets/ace';
    ace.config.set('modePath', path);
    ace.config.set('themePath', path);
    ace.config.set('workerPath', path);
  </script>

to the index.html on the root folder of the project. Of course this was adding all the needed files from ace-builds to the folder assets/ace.

I leave it here in case there is some one else that has to recur to this variant.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 2 defining base url - Stack Overflow
Ok. In my local environment it uses the new path. But on my server it still doesn´t find the resources. – Max.
Read more >
Common Routing Tasks - Angular
Define your routes in your Routes array. Each route in this array is a JavaScript object that contains two properties. The first property,...
Read more >
Angular 2 Series - Part 4: Component Router In-Depth - Auth0
We do this by setting setAsDefault to true on the /details route. // app/User.ts ... @RouteConfig([ { path ...
Read more >
Angular Router: Child Routes, Auxiliary Routes, Master Detail
This is a comprehensive guide to the fundamental concepts of the Angular Router: routes, paths, components, outlets. We will cover both child ...
Read more >
Get Started with AG Grid - Angular Data Grid
Grid Module; Grid CSS and Themes; Setting Row Data; Setting Column Definitions; Accessing the Grid's API; Consuming Grid Events; Grid Properties; Getting ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found