Route guards ਫੰਕਸ਼ਨਾਂ ਹਨ ਜੋ ਕੀ ਕਿਸੇ route ਵੱਲ/ਤੋਂ navigation ਦੀ ਆਗਿਆ ਹੈ ਇਸ ਨੂੰ ਕੰਟਰੋਲ ਕਰਦੇ ਹਨ। ਉਹ ਰੁੱਟ ਸਰਗਰਮ ਹੋਣ ਤੋਂ ਪਹਿਲਾਂ ਚਲਦੇ ਹਨ (ਜਾਂ ਤੁਸੀਂ ਇੱਕ ਤੋਂ ਅਲਗ ਹੋਣ ਤੋਂ ਪਹਿਲਾਂ), authentication checks, permission control, ਅਤੇ "unsaved changes" prompts ਨੂੰ ਸਮਰੱਥ ਬਣਾਉਂਦੇ ਹਨ।
Guard types
CanActivate → can the user enter this route? (auth/permission check)
CanActivateChild → same, for child routes
CanDeactivate → can the user LEAVE? ("you have unsaved changes")
CanMatch → should this route even be matched? (feature flags, role-based)
resolve → pre-fetch data BEFORE the route activates
