Use Bootstrap’s “error” class for styling. You can write less code.
<form name="myForm">
<div class="control-group" ng-class="{error: myForm.name.$invalid}">
<label>Name</label>
<input type="text" name="name" ng-model="project.name" required>
<span ng-show="myForm.name.$error.required" class="help-inline">
Required</span>
</div>
</form>
EDIT:
As other answers and comments point out – in Bootstrap 3 the class is now “has-error”, not “error”.