in your SiteController Add this function to show your csrf token
public function actionCsrf()
{
Yii::$app->response->format = Response::FORMAT_JSON;
return [
'_csrf' => Yii::$app->request->csrfToken
];
}
and add input type hidden in your form like
on html
<form>
...
<input type="hidden" name="_csrf" id="_csrf" value="" />
...
</form>
make get ajax in your angular, its version on jquery
on javascript
<script type="text/javascript">
$.ajax({
type : "GET",
data : "",
dataType: 'json',
contentType: "application/json",
url : "http://localhost/app/web/site/csrf",
success : function(result){
var resultObj = result;
document.getElementById("_csrf").value = resultObj._csrf;
}
});
</script>