TypeScript找不到模块错误

时间:2017-05-16 07:17:29

标签: angular typescript

enter image description here我试图将模板用作指令。为此,我试图将其导入(app.module.ts)。但我得到一个错误“TS2307:找不到模块”。任何人都可以帮我解决这个错误。我还上传了一些图片。

enter image description here

//app.module.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppComponent }  from './app.component';

import { ProductListComponent } from './products/product-list.component';


@NgModule({
  imports: [ BrowserModule ],
  declarations: [ AppComponent, ProductListComponent ],
  bootstrap: [ AppComponent ]
})
export class AppModule { }

.....................................................

//product-list.component.ts

import {Component} from '@angular/core';
@Component({
    selector: 'pm-products',
    templateUrl: 'app/products/product-list.component.html'
})

export class ProductListComponent { }

.................................................

//app.component.ts

import {Component} from '@angular/core';

@Component({
    selector: 'pm-app',
    // not quotes for template
    template: ` 
    <div><h1> {{pageTitle}} </h1>
            <pm-products></pm-products>
    </div>`
})

export class AppComponent {
    pageTitle: string = 'ACME Product Management';
}
<!--
product-list.component.html
-->

<div class="panel panel-primary">
    <div class="panel-heading">
        Product List
    </div>
    <div class="panel-body">
        <div class="row">
            <div class="col-md-2">Filter By:</div>
            <div class="col-md-4">
                <input type="text" />
            </div>
        </div>
        <div class="row">
            <div class="col-md-6">
                <h3>Filtered By: </h3>
            </div>
        </div>
    </div>

    <div class='table-responsive'>
        <table class="table">
            <thead>
                <tr>
                    <th>
                        <button class="btn btn-primary">Show Image</button>
                    </th>
                    <th>Products</th>
                    <th>Code</th>
                    <th>Available</th>
                    <th>Price</th>
                    <th>5 Star Rating</th>
                </tr>
            </thead>
            <tbody>

            </tbody>
        </table>
    </div>
</div>

2 个答案:

答案 0 :(得分:7)

根据您的目录结构,您的// Adding rule to each item in qtyi list jQuery('[id^=qty]').each(function(e) { jQuery(this).rules('add', { minlength: 2, required: true }); }); 文件夹只有一步。你应该试试这个导入:

BEGIN
OPEN c1;
LOOP
    FETCH c1 INTO v_dbname,v_dblink;
    EXIT WHEN c1%NOTFOUND;   
    v_sql:= 'select concat(owner,table_name) from monitor.exp_tab_mon where dbname='||q'('v_dbname')'||' minus select concat(owner,table_name) from dba_tables@'||v_dblink;
    BEGIN
       EXECUTE IMMEDIATE v_sql into v_value;
       EXCEPTION
          WHEN NO_DATA_FOUND THEN
          NULL;
       END;
    END;
    DBMS_OUTPUT.PUT_LINE('RETURN ' || NVL(v_value, '0');
END LOOP;

或在您的应用文件夹中移动您的产品文件夹

答案 1 :(得分:3)

从屏幕截图看,products不在app文件夹中。它高一级,因此打字稿编译器无法找到它。应该通过将其移到app文件夹中来修复该问题。