我们正在开发一个分离项目,Drupal作为我们的后端,Angular作为我们的前端。一切都接近完成,但某些(动态,如在Drupal中创建的)页面需要链接到角度应用程序的不同页面。
例如:
会发生什么:
重新加载整个页面,丢失当前正在进行的任何进程(即播放器中播放的内容),并让用户再次查看我们的加载屏幕。
我们希望发生什么:
我们希望触发路由器转到内部网址,这样我们就不会失去SPA的感觉。 我们尝试使用动态组件来复制它,但由于我们事先不知道内容是什么样的,因此很难实现它。
是否有正式方法(或可能是解决方法)来解决这个问题?我们想象我们可以通过解析从CMS获得的任何链接,或者在我们的CKeditor中进行自定义格式化来解析。但是,一旦我们达到了有意义的一面,我们就不知道应该如何插入我们的HTML,而链接现在在内部工作。
答案 0 :(得分:1)
自从您发布以来已经有一段时间了,但我自己没有找到解决方案,所以想要将其作为未来参考。
我们通过使用我们在html上使用的指令解决了这个问题:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// prototypes
int c_s(char*, char*);
struct sSheet
{
char constab[30];
char vicwit[15];
char witdet[200];
char incdest[300];
char comp1[15];
char comp2[200];
};
typedef struct sSheet sheetstore;
#define ARRAYLEN 2
sheetstore a[ARRAYLEN];
FILE *fp;
int main( void )
{
int i;
char wit[10] = "witness";
//char yes[10] = "yes";
char comp1[10];
fp = fopen("sheetstore.dat","a+");
if( !fp )
{
perror( "fopen for appending to 'sheetstore.dat' failed" );
exit( EXIT_FAILURE );
}
// implied else, fopen successful
puts("Hate crime reporting system\n\n\n");
puts("If the crime you are reporting is an emergency,\n"
"please call 999, "
" do not proceed any further with this form\n\n\n\n"
"Please press enter"
" to confirm you have read the above and continue\n");
int enter = 0;
while (enter != '\r' && enter != '\n')
{
enter = getchar();
}
for( i=0; i<ARRAYLEN ; i++)
{
puts("Which police constabulary did the offence take place in?\n\n");
if( scanf("%29s", a[i].constab) != 1)
{
fprintf( stderr, "scanf for which police constabulary failed" );
fclose( fp ); // cleanup
exit( EXIT_FAILURE );
}
// implied else, scanf successful
指令捕获所有点击并检查目标是否为带有href元素的标记。如果href是相对的,请使用路由器。如果它包含主机名(设置您自己的主机名),它将获取路径并使用路由器。否则它将在新窗口中打开。
<div [innerHTML]='contentFromCMS' appRouteDirective></div>