嗨,谢谢你的阅读.
我有一个角色应用程序正在制作和我偶然发现了一个问题.如此设置
index.html-
<html ng-app="myApp">
...
<div ng-view></div>
<div ng-include="'footer.html'"></div>
...
</html>
Run Code Online (Sandbox Code Playgroud)
我不会打扰我的路线很简单/家是显示/home/index.html等等...
/home/index.html(当你来到网站时的默认视图)
<div class="responsive-block1">
<div class="tweet-me">
<h1> tweet me </h1>
</div>
<div class="twitter-box">
<twitter-timeline></twitter-timeline>
</div>
Run Code Online (Sandbox Code Playgroud)
twitter时间线指令
directives.directive("twitterTimeline", function() {
return {
restrict: 'E',
template: '<a class="twitter-timeline" href="https://twitter.com/NAME" data-widget-id="XXXXXXXXXXXXXX">Tweets by @NAME</a>',
link: function(scope, element, attrs) {
function run(){
(!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"));
console.log('run script');
};
run();
}
};
});
Run Code Online (Sandbox Code Playgroud)
所以我刚刚使用twitter上的标签创建了一个基本的twitter指令.但是当我将视图示例更改为/ blog然后返回/ home时,twitter小部件根本不再呈现.
我也使用$ anchorScroll,如果我在页面上跳转到这个小部件也会消失.任何信息都会非常感谢.
我试图让node-sass-middleware与express一起工作.该应用程序运行没有错误
...(modules)
var sassMiddleware = require('node-sass-middleware');
var routes = require('./routes/index');
var app = express();
// uncomment after placing your favicon in /public
//app.use(favicon(__dirname + '/public/favicon.ico'));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
//---- LOAD SASS -----//
// adding the sass middleware
var srcPath = __dirname + '/scss';
var destPath = __dirname + '/public/stylesheets';
app.use(sassMiddleware({
src: srcPath,
dest: destPath,
debug: true,
outputStyle: 'compressed'
}));
app.use(express.static(path.join(__dirname, 'public')));
Run Code Online (Sandbox Code Playgroud)
任何人都可以看到我试图编译sass的方式有什么问题吗?
文件结构:
app
controllers
routes
public
-stylesheets
scss
...
Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的amazon ec2实例上安装apache.
我用的时候:
sudo yum -y install httpd
Run Code Online (Sandbox Code Playgroud)
我与httpd2.2发生冲突
Error: httpd24-tools conflicts with httpd-tools-2.2.25-1.0.amzn1.x86_64
Run Code Online (Sandbox Code Playgroud)
但我不能删除旧版本使用:
yum remove httpd-tools-2.2.25-1.0.amzn1.x86_64
yum remove httpd
Run Code Online (Sandbox Code Playgroud)
我刚收到错误
Loaded plugins: priorities, update-motd, upgrade-helper
No Match for argument: httpd-tools-2.2.25-1.0.amzn1.x86_64
No Packages marked for removal
Run Code Online (Sandbox Code Playgroud)
或加载的插件:priority,update-motd,upgrade-helper参数匹配:hhtpd没有标记为要删除的软件包
我是设置这些实例的新手,所以任何帮助都会提前得到赞赏,谢谢.
过去几周我一直在学习angularJs,并且正在研究一些大型应用程序,以了解现实世界中的工作原理.在大多数情况下,我注意到加载视图时:
ng-init="init()"
Run Code Online (Sandbox Code Playgroud)
即在相关控制器中调用函数init().用于设置初始值.
但是(很大但是)在阅读ngInit上的角度文档时,我得到了一个相当严厉的描述:
"ngInit唯一适当的用于别名ngRepeat的特殊属性,如下面的演示所示.除了这种情况,你应该使用控制器而不是ngInit来初始化作用域上的值."
所以我的问题是,在加载视图时使用ngInit初始化作用域中的值是不好的做法?如果是这样,为什么会这样?什么是正确的方法?
我的问题很简单,如果我有一个像这样的javascript函数onload
<body onload="myFunction()">
Run Code Online (Sandbox Code Playgroud)
这个函数会在PHP的其余部分之前执行吗?