Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Can't add typings file to Angular 7 project (Read 1250 times)
twojtylak
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 9
Joined: Jan 9th, 2019
Can't add typings file to Angular 7 project
Jan 9th, 2019 at 6:07pm
Print Post  
I have an Angular 7 project where I am including the 'diagram-library' module in my component, but I am getting an error saying that 'jsdiag.d.ts' is not a module. I have Googled for answers and found a couple stating I should include
Code (Javascript)
Select All
/// <reference path="node_modules/diagram-library/jsdiag.d.ts" /> 

, but everywhere I've tried to put this doesn't seem to work.

For reference, here is my component:
Code (Javascript)
Select All
import {Component, OnInit} from '@angular/core';
import {MindFusion} from 'diagram-library';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {

    constructor() {

    }

    ngOnInit() {

    }

} 



Any suggestions?
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Can't add typings file to Angular 7 project
Reply #1 - Jan 10th, 2019 at 8:07am
Print Post  
Hi,

Are you using the latest version of diagram-library from npm - version 3.3.0? If yes, the following should be enough:
Code (Javascript)
Select All
import * as c from 'mindfusion-common';
import * as m from 'diagram-library';

import Diagram = m.Diagramming.Diagram;
//... 



If using an older version, you need to add that reference path in the typings.d.ts file in your src folder and manually reference the required scripts in the angular.json configuration file. That approach is shown in the \Angular\MinApp sample, included with the JsDiagram package.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
twojtylak
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 9
Joined: Jan 9th, 2019
Re: Can't add typings file to Angular 7 project
Reply #2 - Jan 10th, 2019 at 3:10pm
Print Post  
Thank you so much! That worked! I didn't know I also needed to import 'mindfusion-common'.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint