此代码是带有离子3的angularjs 1.4x。我想在带有离子4的angular 7中实现此代码的一些更改。我收到类似“找不到名称'angular'”的错误。请帮助我。
var vector = angular.element(document.querySelector('[ng-app=vectorApp]')).scope().$root;
答案 0 :(得分:0)
不要连续保留旧的代码库,您必须迁移某种方式,所以现在就开始吧,否则您在保留旧的代码库时会遇到很多问题,因此我的建议是迁移到<div class="category-output">
<ul>
</ul>
</div>
<ul class="main-category-check">
<li>
<p>
<label>
<input type="checkbox" class="filled-in categoryCheck"
name="season2" />
<span>Category 1</span>
</label>
</p>
<ul class="sub-category-check">
<li>
<p>
<label>
<input type="checkbox" class="filled-in"
name="season2" />
<span>Sub Category 1</span>
</label>
</p>
</li>
<li>
<p>
<label>
<input type="checkbox" class="filled-in"
name="season2" />
<span>Sub Category 2</span>
</label>
</p>
</li>
<li>
<p>
<label>
<input type="checkbox" class="filled-in"
name="season2" />
<span>Sub Category 2</span>
</label>
</p>
</li>
<li>
<p>
<label>
<input type="checkbox" class="filled-in"
name="season2" />
<span>Sub Category 2</span>
</label>
</p>
</li>
<li>
<p>
<label>
<input type="checkbox" class="filled-in"
name="season2" />
<span>Sub Category 2</span>
</label>
</p>
</li>
</ul>
</li>
<li>
<p>
<label>
<input type="checkbox" class="filled-in categoryCheck"
name="season2" />
<span>Category 2</span>
</label>
</p>
<ul class="sub-category-check">
<li>
<p>
<label>
<input type="checkbox" class="filled-in"
name="season2" />
<span>Sub Category 1</span>
</label>
</p>
</li>
<li>
<p>
<label>
<input type="checkbox" class="filled-in"
name="season2" />
<span>Sub Category 2</span>
</label>
</p>
</li>
</ul>
</li>
<li>
<p>
<label>
<input type="checkbox" class="filled-in categoryCheck"
name="season2" />
<span>Category 3</span>
</label>
</p>
<ul class="sub-category-check">
<li>
<p>
<label>
<input type="checkbox" class="filled-in"
name="season2" />
<span>Sub Category 1</span>
</label>
</p>
</li>
<li>
<p>
<label>
<input type="checkbox" class="filled-in"
name="season2" />
<span>Sub Category 2</span>
</label>
</p>
</li>
</ul>
</li>
</ul>
$('.sub-category-check li input').click(function () {
if ($(this).is(':checked')) {
$(this).parents('p').parent().siblings().find('input').prop('checked', false).attr('disabled', true);
var Check1 = $(this).siblings('span').text();
$('.category-output ul').append('<li class="chip">' + Check1 + '<i class="close material-icons">close</i>' + '</li>');
}
else {
$(this).parents('p').parent().siblings().find('input').attr('disabled', false);
$('.category-output ul li').remove();
//$('.category-output ul').append('<li class="chip">' + Check1 + '<i class="close material-icons">close</i>' + '</li>');
}
}
);
https://wtcindia.wordpress.com/2016/09/23/top-5-reasons-why-one-must-migrate-to-angular-2/