fis3-demo icon indicating copy to clipboard operation
fis3-demo copied to clipboard

fis3-angular-demo

Open Jsming-G opened this issue 9 years ago • 2 comments

源码 angular.module('example', []).config(function($stateProvider, $urlRouterProvider) { $stateProvider.state('example', { url: '/example', template: __inline('./example.html') }).state('example.dropdown', { url: '/dropdown', templateUrl: __inline('./dropdown.html') }); }); 编译后: define('example', function(require, exports, module) { 'use strict'; angular.module('example', []).config(function($stateProvider, $urlRouterProvider) { $stateProvider.state('example', { url: '/example', template: "<div class="col-md-2">\r\n<a ui-sref="example.dropdown" class="btn btn-success">dropdown\r\n" }).state('example.dropdown', { url: '/dropdown', template: "dropdown.html" }); }); });

问题 dropdown.html内容为什么没加载进来?

Jsming-G avatar Jul 15 '15 08:07 Jsming-G

我们是直接把 template 编译成 js,而不再发起另外一个请求。

oxUnd avatar Jul 15 '15 08:07 oxUnd

__inline是内容嵌入语法,直接把html嵌入到js里面,所以应该加在template而不是templateUrl后面,grunt也有类似的插件把html嵌入到js里面,而fis直接用嵌入语法就行了。这是推荐的做法,否则html内容改变可能被缓存住导致页面未更新

zhangtao07 avatar Jul 17 '15 02:07 zhangtao07