我正在尝试在Angular2项目中使用mdl-stepper。 在我的HTML中:
<li class="mdl-step">
<span class="mdl-step__label">
<span class="mdl-step__title">
<span class="mdl-step__title-text">Step 2</span>
</span>
</span>
<div class="mdl-step__content">
<h4>Step 2</h4>
</div>
<div class="mdl-step__actions">
<button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--colored mdl-button--raised" data-stepper-next>
Continue
</button>
<button class="mdl-button mdl-js-button mdl-js-ripple-effect" data-stepper-cancel>
Cancel
</button>
<button class="mdl-button mdl-js-button mdl-js-ripple-effect" data-stepper-back
(click)="onstepback($event)">
Back
</button>
</div>
</li>
在后退按钮上单击我正在发射一个事件。在home.component.ts
onbackstep(){}
内的var stepperElement = document.querySelector('ul.mdl-stepper');
var Stepper;
Stepper = stepperElement.MaterialStepper;
文件中,我有以下内容:
Property 'MaterialStepper' does not exist on type 'Element'
它给我编译错误<form action="{{ url_for('mod_inst.addsrvtype') }}" method="post" class="sky-form">
<header>Add Package Template</header>
<fieldset>
<section>
<label class="label">Template Name</label>
<label class="input">
<input type="text" name="name" placeholder="Enter a name.. 3 Package Private Lesson, etc">
</label>
<div class="note"><strong>Note:</strong> This is required, your students will not see this name.</div>
</section>
<div class="row">
<section class="col col-6">
<label class="label">Price</label>
<label class="input">
<i class="icon-append fa fa-dollar"></i>
<input type="text" name="price" value="">
</label>
</section>
<section class="col col-6">
<label class="label">Tax</label>
<label class="input">
<i class="icon-append fa fa-percent"></i>
<input type="text" name="tax" value="">
</label>
</section>
</div>
<div class="row">
<button type="button" class="hideDiv">Unhide this row</button>
<div class="hidden">
Hello
<div class="row">
<button class="hideDiv">Unhide this row</button>
<div class="hidden">
Hello
<div class="row">
<button class="hideDiv">Unhide this row</button>
<div class="hidden">Hello</div>
</div>
</div>
</div>
</div>
</div>
</fieldset>
<footer>
<button type="submit" class="button">Add Service</button>
<button type="button" class="button button-secondary" onClick="window.history.back();">Cancel</button>
</footer>
<!-- END CONTENT -->
</div><!-- END accordion CONTENT -->
</div><!-- END accordion ITEM -->
我必须输入一些东西吗?
答案 0 :(得分:0)
尝试使用 var stepperElement = document.querySelector(selector);
它为我工作。现在没有错误。