2017-09-11 6 views
0

のロードに失敗しました。ここディレクティブAngularjsはここtemplateurl

moduleDirectives 
.directive('barNotification', ['$compile', '$timeout', function ($compile, $timeout) { 
    return { 
     restrict: 'E', 
     replace: true, 
     scope: { 
      barShow:'=', 
      barType: '=', 
      barMessage:'=', 
      barAllowClose:'=', 
      onClose: '&', 
      onOpenSlopeSetting: '&' 
     }, 
     link: function (scope, element, attr) { 
      scope.contentElement = element; 
      scope.onCloseExists = 'onCloser' in attr; 
      scope.$watch('barMessage', function() { 
       $timeout(
         function() { 
          angular.element(scope.contentElement[0].querySelector('#barMessage')).replaceWith($compile('<div id="barMessage">' + scope.barMessage + '</div>')(scope)); 
         }); 
      }, true); 
     }, 
     templateUrl: '/Areas/Claim/Singlepage/directives/barnotification/barNotification.cshtml', 
     controller: 'barNotificationController' 
    }; 
}]); 

あるアプリの負荷が、私は次のエラーを取得する場合は、プロジェクトディレクトリは

enter image description here

です。

[$コンパイル:tpload]をテンプレートの読み込みに失敗しました: /Areas/Claim/Singlepage/directives/barnotification/test.cshtml(HTTPステータス :403禁止)

私は何を逃しました?

+0

私は、サーバーの応答が403であることに気付きます。ブラウザのファイルに直接アクセスしてファイルの内容を取得できますか? – nosthertus

答えて

0

を取り除くbaseUrl

に比べてみてください呼び出します。これはweb.config <add key="webpages:Enabled" value="false" />の行です。私がロードしようとしているページは.cshtml IIS chocksです。 web.configからこの行を削除するか、値をtrueに変更して問題を解決してください。

0

あなたのURLが絶対であるため、あなたのテンプレートが読み込まれていないので、URLアドレス/Areas/Claim/Singlepage...を見てください。ブラウザがそのURLへのAJAX呼び出しを試みると、そのURLを検索します。私はそれがweb.configファイルの問題である疑いがあるとして最初のスラッシュAreas/Claim/Singlepage...

+0

ありがとうございましたが、私は同じ問題を以前に試みました。 btw、私は別のプロジェクトで正確な指示を使用しており、それは動作します。私は新しいプロジェクトに取り組んでおり、コードを再利用しようとしていますが、この問題に取り組んでいます。私はweb.configとは何かを疑っていますが、まだ手掛かりはありません。 – yesIcan

+0

あなたはネットワーキングログをチェックしましたか?それが相対baseURLからの呼び出しを行っているかどうか確認できますか? – nosthertus

+0

情報: プロセスID:11772 プロセス名:w3wp.exeの アカウント名:IIS APPPOOL \ claimClient 例外情報: 例外の種類:HttpException 例外メッセージ:パス「/エリア/請求/ Singlepage /ディレクティブ/ barnotification/barNotification.cshtml 'は禁止されています。 System.Web.HttpApplication.ExecuteStepでSystem.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() でSystem.Web.HttpForbiddenHandler.ProcessRequest(のHttpContextコンテキスト) で(IExecutionStepステップ、ブール&completedSynchronously) – yesIcan