考虑以下代码
my_app.run( [ '$templateCache' , function( $templateCache ) {
var template = "" +
"{{ item.name }}" +
"<ul ng-if='item.sub'>" +
"<li ng-repeat='item in item.sub' ng-include=\"'angular-multi-select-item.htm'\"></li>" +
"</ul>" +
"";
$templateCache.put( 'angular-multi-select-item.htm' , template );
}]);
虽然这个方法能够正常工作,但是我认为它很丑(拼接的字符串内嵌有html代码)。是否有其他更加简洁的方式来定义Angular模板中的html呢?
project_root/libraries/npm/my_library/view.html
。我怎么知道我的视图是保存在那里的? - alexandernst