How can I use the "ngx-doc-viewer" package in the vue 2 class style with typescript project? - vue-class-components

i want to use "ngx-doc-viewer" package in vue project. But i can not understand how to use this in vue 2 class style with typescirpt project .
Here is the link
ngx-package
i am thinking about of how to use this NgxDocViewerModule module in vue.
Let me know if you can help me with this.
Thanks

Related

How can I decide dynamically the base path of my templates in Angular 2?

Say I have two versions of each template, how can I define the base path of them dinamically so I can use one or the other through configuration?
Basically how do I declare TEMPLATES_PATH so it can be used like this:
component.ts
#Component({
templateUrl: TEMPLATES_PATH + 'template1.html';
})
I tried declaring a constant in my root file but when I import it, it doesn't have a value, maybe I'm importing it or declaring it wrong?
root.ts
export const TEMPLATES_PATH = './somepath/'
component.ts
import {TEMPLATES_PATH} from "../../boot";
Perhaps you could use a dedicated file for constants and import it.
I made a test and it works for me with your (constant creation and import).
I think that your problem comes from a circular dependency between modules. The root module imports the component module which imports the root module.
Hope it helps you,
Thierry

Unable to import org.apache.common.collections.list

I am using Groovy Grails Tool Suite for my Grails project.
I am trying to use LazyList.decorate in one of my domain classes and so want to import org.apache.common.collections.list within the domain class.
I see that org.apache.commons.collections_3.2.0.v2013030210310.jar is available under the GGTS plugins folder.
However, the editor shows an error at the import statement saying "Groovy: Unable to resolve org.apache.common.collections.list".
Please help!
Since the question is missing a code snippet I suspect you have a line like this import org.apache.common.collections.list. You should do import org.apache.common.collections.list.* - or if only LazyList is what you want: import org.apache.common.collections.list.LazyList

Defining module names with Typescript

I'm trying to use TypeScript with RequireJS but I'm getting the following error:
Mismatched anonymous define() module.
I understand this is because Typescript is not emitting a module name and I'm loading the scripts into the page myself (I'm doing this as they are defined as a pre-defined bundle in the MVC project).
Currently the outputted .js looks like this:
define(["require", "exports", "jquery"], function(require, exports, $) {...
When I need it to emit:
define("MODULE_NAME" ["require", "exports", "jquery"], function(require, exports, $) {...
Is this possible with Typescript or should I look at replacing the bundle for minimization with Require.js's own optimization?
If you are using ASP.NET and the integrated script bundling, you are correct: The problem is that the bundle contains multiple anonymous modules. While it is good, common practice to work with anonymous modules (and let some compressor/optimizer do the naming later), this won't work for ASP.NET bundling because it only concatenates the input JS files. The solution is to make TypeScript create named modules. And this is possible with TS, so the answer to your question
Is this possible with Typescript
is definitely: Yes!
TypeScript 1.4 added the ability to emit AMD named modules to the compiler, like this:
///<amd-module name='NamedModule'/>
export class C {
}
The issue is not in the code generation (which is correct). The issue is that you probably have a script tag loading this JavaScript file. It should only be loaded by RequireJS, using data-main or as a dependency of another module.
See : http://requirejs.org/docs/errors.html#mismatch
Remove the script tag

Changing the Gridpanel class in Gridworld

I am trying to follow the steps to change the Gridworld appearance according to this. I've already imported source code for my gridworld jar file; ie. I can go and look at Bug.class or Gridpanel.class if I wanted to. However, I can't edit these files to produce the results that that pdf suggests. How do I do this? Did I import the source code incorrectly?
I don't think you can edit an external resource like gridworld.jar. You are going to need to create 4 new packages:
actor
grid
gui
world
Then copy the class files from gridworld.jar packages into your corresponding ones. Now you can edit the files. Make sure you include any miscellaneous files that might also be in the gridworld.jar packages, their important.
With your own packages you no longer need the gridworld.jar external resource, and there is a difference in your import statements. Instead of
import gridworld.actor.Actor;
Do this:
import actor.Actor;
Note: You will need to change all of the import statements in the new package classes to reference the other new packages. I believe that there were also some errors, not project breaking, but I just added suppressors.

The included part ''xclickcounter.dart'' must have a part-of directive

Create a sample web application using the Web UI (web_ui) library, e.g., mylib
open mylib.dart, make it a library:
library mylib;
import 'dart:html';
import 'package:web_ui/web_ui.dart';
part 'xclickcounter.dart';
...
open xclickcounter.dart, remove imports and insert:
part of mylib;
web/out/mylib.dart and web/out/xclickcounter.dart get messed up:
The included part ''xclickcounter.dart'' must have a part-of directive
Classes can only mixin other classes
Mixin can only be applied to class
... more errors follow
What am I doing wrong? Please help :(
Edit: if I don't edit generated sample code, wdc will generate code that falls into separate libraries:
web/out/xclickcounter.dart => x_click_counter
web/out/mylib.dart => mylib_html
Does it mean that if we use web_ui we should not create our own libraries and wdc will do this for us automatically?
Update: if I don't use any library name, similar to what generated sample code does, and only rely on the library names generated by xdc in web/out/... files, I still run into trouble when importing my two components into a 3rd file. Dart Editor will produce the following warning:
The imported libraries 'compa.dart' and 'compb.dart'
should not have the same name
The workaround is to name your libraries based on what xdc produces in web/out/... files, that is:
compa.dart => x-comp-a
compb.dart => x-comp-b
After explicitly placing components into libraries like these the Dart Editor warning disappears.

Resources